lair of the dustbunny
Sunday, November 2, 2008
99 problems - python - 16
Drop every N'th element from a list.
def drop(lst, n):
for i,x in enumerate(lst):
if (i+1) % n != 0:
yield x
No comments:
Post a Comment
‹
›
Home
View web version
No comments:
Post a Comment