File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,14 +3,22 @@ export const examples = [
33 title : "NameError - Variable Not Created Yet" ,
44 runtime : "skulpt" ,
55 expectedVariantId : "NameError/variants/0" ,
6- code : `def show_total():
7- print(total)
6+ code : `def outer():
7+ def inner():
8+ return total
89
9- show_total()` ,
10+ print(inner())
11+ total = 10
12+
13+ outer()` ,
1014 trace : `Traceback (most recent call last):
11- File "main.py", line 4, in <module>
12- File "main.py", line 2, in show_total
13- NameError: free variable 'total' referenced before assignment in enclosing scope`
15+ File "main.py", line 8, in <module>
16+ outer()
17+ File "main.py", line 5, in outer
18+ print(inner())
19+ File "main.py", line 3, in inner
20+ return total
21+ NameError: cannot access free variable 'total' where it is not associated with a value in enclosing scope`
1422 } ,
1523 {
1624 title : "NameError - Variable Not Defined Here" ,
You can’t perform that action at this time.
0 commit comments