Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def purity(listy):
- pure_listy = []
- for key in listy:
- if key % 2 == 0:
- pure_listy.append(key)
- else:
- print key
- print pure_listy
- return pure_listy
- purity([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19])
- """
- output prints:
- 1
- 3
- 5
- 7
- 9
- 11
- 13
- 15
- 17
- 19
- [2,4,6,8,10,12,14,16,18]
- which is exactly what i want but the exercise is telling me
- "Your code threw a "'builtin_function_or_method' object has no attribute '__getitem__'" error.
- """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement