Aug-21-2019, 01:53 AM
I'm trying to remove all the numbers from a list, but when I run the code, I get a strange result:
nums = [1, 2, 3, 4, 5] words = ["I", "sing", "of", "arms", "and", "a", "man"] both = nums + words for each in both: if each in range(1000): both.remove(each) print(both)
Output:[2, 4, 'I', 'sing', 'of', 'arms', 'and', 'a', 'man']
Process finished with exit code 0
What are the 2 and 4 still there?