Write a python function that returns every nth element in a list


Topic: Write a python function that returns every nth element in a list

Solution

def every_nth(lst, nth):
  return lst[nth - 1::nth]



List all Python Programs