0

I'm trying to write code to check a list for any odd numbers, and then add all the even numbers to a new list and then print the new list. However, I'm getting an error that my program crashes on [1]. This tells me that the program worked on index 0.. or at least I believe it did. Does anybody have any ideas on why I'm getting this error and why it's not iterating through my whole list?

Thanks

def purify(list):
>     def is_odd(list):
>     newList = []
>     for item in list:
>       if item %2 != 0:
>         is_odd = True
>         for word in list:
>           if is_odd == True:
>             break
>           else:
>             is_odd= False
>             newList.append(word)
>     print newList

Error: Your function crashed on [1] as input because your function throws a "'NoneType' object is not iterable" error

J.Elliott
  • 1
  • 2
  • Possible duplicate of [TypeError: 'NoneType' object is not iterable in Python](https://stackoverflow.com/questions/3887381/typeerror-nonetype-object-is-not-iterable-in-python) – AGN Gazer Jun 13 '18 at 19:20
  • Could you edit the full traceback into the question? – glibdud Jun 13 '18 at 19:20

0 Answers0