Freezing the Loop Variable
def make_multipliers():
fns = []
for i in range(3):
fns.append(lambda n, x=i: n * x)
return fns
fns = make_multipliers()
print(fns[2](10))
What is printed? (Give just the value.)
Sign in to answer questions and track your progress
Sign In