Saturday, November 1, 2008

99 problems - python - 14

Duplicate the elements of a list.

def duplicate_elements(lst):
for x in lst:
yield x
yield x

No comments: