Closures Keep Their Enclosing Variables
def make_multiplier(factor):
def multiply(x):
return x * factor
return multiply
double = make_multiplier(2)
triple = make_multiplier(3)
print(double(5), triple(5))
What does this print?
Sign in to answer questions and track your progress
Sign In