lair of the dustbunny
Sunday, November 2, 2008
99 problems - python - 15
Replicate the elements of a list a given number of times.
def replicate_elements(lst, n):
for x in lst:
for y in range(n):
yield x
No comments:
Post a Comment
‹
›
Home
View web version
No comments:
Post a Comment