I was trying to do a challenge on codeeval in python3 and got stuck trying to improve my solution. Every time i tried to iterate (or print, or some other action) two times consecutively over the same iterator, the second loop came up empty. Here is a minimal example that produces this behavior, although I tried several different combinations with lists etc. that gave me the same result:
numbers = ('1','2','3','4','5')
numbers = map(int, numbers)
print(list(numbers))
print(list(numbers))
results in:
[1, 2, 3, 4, 5]
[]
Why does print (in this case) delete the content of numbers?