๐ Bug HuntPY Python Hard+35 XP
Scope Error in Loop
This should create 3 functions that print 0, 1, 2 but all print 2.
๐ Find the bug
1
functions = []2
for i in range(3):3
functions.append(lambda: print(i))4
5
for f in functions:6
f()๐ The bug is on line 3