Loud bugs
Python stops and shows an error. Good news: it tells you the line!
print("hi)08BUGS · CODE
Now the bugs hide in real Python. Some make Python stop. Others hide and give the wrong result.
TWO KINDS OF BUGS
Python stops and shows an error. Good news: it tells you the line!
print("hi)The code runs, but the result is wrong. Python can't tell. You compare the result with what you wanted.
print(2 + 3) # wanted 2 * 3Even the best programmers write bugs every day. A bug is not a failure. It is a clue.
RUN IT
Guess first. Then run real Python and check.
name = "PyBot"
print("Hello!")
print(nme)What will Python show?
PyBot's hint
Ready. Press Run Python.
Pyodide 314.0.3 runs CPython in your browser with WebAssembly.
Open-source under the Mozilla Public License 2.0. License
Now change one thing: Run it and read PyBot's hint. Then fix line 3 and run again.
YOUR TURN
Every card hides a bug. Some are loud, some are sneaky. A wrong answer becomes something to review.
What is the bug here?
Which line has the bug?
score = 10
print(scroe)line 2 NameError: name 'scroe' is not defined
What is the clue telling you?
PyBot wanted to jump 3 times. It jumped only 2.
for turn in range(2):
print("jump")Where is the sneaky bug?
PyBot wanted to see 4. Python showed 2 + 2.
print("2 + 2")Why didn't PyBot see 4?
if light = "green":
print("go")Which first line squashes the bug?
Tap the line with the sneaky bug.
Run it. Read the clue. Fix the bug and match the goal.
apple cookie grape Yum!OUTPUT
No error, but the total is wrong. PyBot wanted 4 + 9 + 2.
15OUTPUT
This box hides two bugs. Fix one, run again, then hunt the next one.
Hi, AnaOUTPUT
Want a fresh start? Clear only this page.
Look, read the clue, fix one thing, run again. That is how every programmer in the world works.