Editor

Fix the Bug: Broken Calculator

Beginner · Fix the bug · from Python for Beginners: Your First Program in 5 Minutes

From the lesson: Python for Beginners: Your First Program in 5 Minutes

Have you ever wondered how apps like Instagram, Spotify, or YouTube actually work? Behind every app, website, and game, there's code - instructions written by a person telling the computer what to do.

Read the lesson

This code should calculate the area of a rectangle (width × height) and print it. But it has two bugs!

Try running the broken code first and read the error message. Then fix both bugs so the output is:

Area: 35
width = 5
height = 7
area = width + height
print("Area: " + area)

More for Beginners exercises

All Python exercises · 50 practice problems · Python Fundamentals quiz