Skip to content

Commit 53934b1

Browse files
committed
Update docs/demo ordering
1 parent 8bd360e commit 53934b1

1 file changed

Lines changed: 49 additions & 49 deletions

File tree

docs/demo-examples.js

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,22 @@ print(kittens)`,
2929
trace: `Traceback (most recent call last):
3030
File "main.py", line 2, in <module>
3131
NameError: name 'kittens' is not defined`
32+
},
33+
{
34+
title: "NameError - Variable Used Before Assignment",
35+
runtime: "skulpt",
36+
expectedVariantId: "UnboundLocalError/variants/0",
37+
code: `def calculate():
38+
result = x + 5
39+
x = 10
40+
return result
41+
42+
calculate()`,
43+
trace: `Traceback (most recent call last):
44+
File "main.py", line 5, in <module>
45+
calculate()
46+
File "main.py", line 2, in calculate
47+
UnboundLocalError: local variable 'x' referenced before assignment`
3248
},
3349
{
3450
title: "SyntaxError - Missing Colon",
@@ -65,28 +81,6 @@ File "main.py", line 1
6581
if score > 10::
6682
^
6783
SyntaxError: invalid syntax`
68-
},
69-
{
70-
title: "SyntaxError - Unterminated String",
71-
runtime: "pyodide",
72-
expectedVariantId: "SyntaxError/variants/5",
73-
code: `print("Hello`,
74-
trace: `Traceback (most recent call last):
75-
File "main.py", line 1
76-
print("Hello
77-
^
78-
SyntaxError: unterminated string literal (detected at line 1)`
79-
},
80-
{
81-
title: "SyntaxError - Missing Comma",
82-
runtime: "pyodide",
83-
expectedVariantId: "SyntaxError/variants/6",
84-
code: `numbers = [1 2, 3]`,
85-
trace: `Traceback (most recent call last):
86-
File "main.py", line 1
87-
numbers = [1 2, 3]
88-
^
89-
SyntaxError: invalid syntax. Perhaps you forgot a comma?`
9084
},
9185
{
9286
title: "SyntaxError - Bracket Not Closed",
@@ -110,6 +104,28 @@ File "main.py", line 1
110104
values = [1, 2, 3)
111105
^
112106
SyntaxError: closing parenthesis ')' does not match opening bracket '['`
107+
},
108+
{
109+
title: "SyntaxError - Unterminated String",
110+
runtime: "pyodide",
111+
expectedVariantId: "SyntaxError/variants/5",
112+
code: `print("Hello`,
113+
trace: `Traceback (most recent call last):
114+
File "main.py", line 1
115+
print("Hello
116+
^
117+
SyntaxError: unterminated string literal (detected at line 1)`
118+
},
119+
{
120+
title: "SyntaxError - Missing Comma",
121+
runtime: "pyodide",
122+
expectedVariantId: "SyntaxError/variants/6",
123+
code: `numbers = [1 2, 3]`,
124+
trace: `Traceback (most recent call last):
125+
File "main.py", line 1
126+
numbers = [1 2, 3]
127+
^
128+
SyntaxError: invalid syntax. Perhaps you forgot a comma?`
113129
},
114130
{
115131
title: "SyntaxError - Assignment In Condition",
@@ -168,6 +184,17 @@ File "main.py", line 2
168184
print("Oops")
169185
^
170186
IndentationError: unexpected indent`
187+
},
188+
{
189+
title: "TypeError - Adding String and Number",
190+
runtime: "pyodide",
191+
expectedVariantId: "TypeError/variants/0",
192+
code: `age = 10
193+
message = "I am " + age + " years old"`,
194+
trace: `Traceback (most recent call last):
195+
File "main.py", line 2, in <module>
196+
message = "I am " + age + " years old"
197+
TypeError: can only concatenate str (not "int") to str`
171198
},
172199
{
173200
title: "AttributeError - Using .push() on List",
@@ -190,33 +217,6 @@ name.shrink()`,
190217
File "main.py", line 2, in <module>
191218
name.shrink()
192219
AttributeError: 'str' object has no attribute 'shrink'`
193-
},
194-
{
195-
title: "TypeError - Adding String and Number",
196-
runtime: "pyodide",
197-
expectedVariantId: "TypeError/variants/0",
198-
code: `age = 10
199-
message = "I am " + age + " years old"`,
200-
trace: `Traceback (most recent call last):
201-
File "main.py", line 2, in <module>
202-
message = "I am " + age + " years old"
203-
TypeError: can only concatenate str (not "int") to str`
204-
},
205-
{
206-
title: "NameError - Variable Used Before Assignment",
207-
runtime: "skulpt",
208-
expectedVariantId: "UnboundLocalError/variants/0",
209-
code: `def calculate():
210-
result = x + 5
211-
x = 10
212-
return result
213-
214-
calculate()`,
215-
trace: `Traceback (most recent call last):
216-
File "main.py", line 5, in <module>
217-
calculate()
218-
File "main.py", line 2, in calculate
219-
UnboundLocalError: local variable 'x' referenced before assignment`
220220
},
221221
{
222222
title: "IndexError - List Index Out of Range",

0 commit comments

Comments
 (0)