A bug: it runs, but the answer is wrong
The program has a mistake on the line marked bug. Python does not complain, because the grammar is fine. Fix it so the total is 42.
A program is a list of exact instructions that a computer follows in order. Almost every program takes some input, does some processing, and produces output; the text you write is called source code, and a mistake in it is called a bug.
Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.
Ready for more? This phase has 5 hands-on exercises with automatic checks.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
Write a program that prints the three steps for brushing your teeth, one per line, in the correct order.
Write a program that remembers the prices of a pen (10) and a notebook (45), adds them, and prints Total: 55.
This program should print the cost of three pencils at 5 each, but it prints 10. Find and fix the bug: pencil = 5 then cost = pencil + pencil then print("Cost:", cost).
Explain it without notes
In your own words, what is a program?
What are the three parts that almost every program has? Give an example of each for a calculator app.
What is a bug, and why can't the computer find every bug for you?
Why does the order of statements matter?
Expected output
Total: 60