Post

TechGuideHub
TechGuideHub@TechGuideHub·
@clcoding The loop creates 3 functions and stores them in funcs. But each function doesn't store the value of i at the time it is created. Instead, each function store the i after the loop finishes: i = 2 Print of all the functions: [f() for f in funcs] results in: [2, 2, 2]
English
0
0
1
31
Paylaş