A map is built on a filter, and the list changes before the results are read.
nums = [3, 8, 1, 6]
m = map(lambda n: n * 2, filter(lambda n: n > 2, nums))
nums.append(10)
print(list(m), list(m))
What does the program print?
Log in to join the discussion.
Loading…