7

Lesson 7 of 20 ยท Fix It!

Fix It! โ€” Part 15

Find what's wrong and fix it. This is part 15 of 20.

What you'll learn

You will run correct code, introduce a small bug on purpose, see the wrong result, and fix it to get the right result again.

Steps

  1. 1Run the code. Total is 5.
  2. 2Change y to 5. Run. What is the total?
  3. 3Cause a bug: change the last line to print(x). Run. Wrong! Fix it.
  4. 4Reading the code helps find bugs. Step through each line.

Key Terms

Bug
A mistake in the code that makes the program do something wrong or unexpected.
Debug
To find and fix bugs. You look at the code and the output to figure out what's wrong.
Fix
To change the code so it works correctly. Fixing bugs is part of coding.
Python 3
Output
Loading Python... This may take a few seconds.

Your code runs only in your browser. No code is sent to any server. Stay safe and have fun learning!

Fix It! โ€” Part 15 โ€” Fix It! | Pre-School Coding | LittleActivity | LittleActivity