Example Closure ,
def f(x, y):
nom, denom = x, y
def g():
return nom / denom
return g
a = f(1, 2)
b = f(3, 4)
fun1 = a
fun2 = b
print(fun1())
print(fun2())
def f(x,y):
nom,denom = x,y
def g():
return nom/denom
return g
a=f(1,2)
b=f(3,4)
print(a is not None)
print(a!=b)
print(a() == 4)
print(b() == 4)
B,C
upvoted 1 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
macxsz
Highly Voted 2 years, 6 months agoDamon54
Most Recent 9 months, 3 weeks agoseaverick
10 months ago