lair of the dustbunny
Monday, November 3, 2008
99 problems - python - 21
Insert an element at a given position into a list.
def insert_at(x, lst, n):
return lst[:n-1] + [x] + lst[n-1:]
No comments:
Post a Comment
‹
›
Home
View web version
No comments:
Post a Comment