Can someone please explain what happens to the map object? Why is the second list empty?
res = map(lambda x: 1 + x, range(1,5))
print (list(res))
print (list(res))
Result:
[2, 3, 4, 5]
[]
Can someone please explain what happens to the map object? Why is the second list empty?
res = map(lambda x: 1 + x, range(1,5))
print (list(res))
print (list(res))
Result:
[2, 3, 4, 5]
[]