All challenges
Free Guided

Tip Calculator

Software Engineering · Beginner · 50 points · about 30 min

Write a small Python program that works out a restaurant tip. It is your first program that takes input and gives output.

Start here · about 30 min

Stuck? Open a hint. Try the first one before the next.

Hint 1

bill = float(input("Bill amount: ")) reads a number from the user.

Hint 2

The tip is bill * percent / 100.

Hint 3

round(value, 2) rounds to 2 decimal places.

Hint 4

Put the conversion inside try/except ValueError to show the friendly message.

What you'll build

A Python program that asks for a bill and a tip percentage, then prints the tip and the total.

Your checklist

  • Ask the user for the bill amount
  • Ask for the tip percentage
  • Print the tip and the total, rounded to 2 decimal places
  • If the user types something that is not a number, show a friendly message instead of crashing
  • Add a README with an example run

Skills you'll practise

Python, input and output, arithmetic, error handling

How it's assessed

A strong submission runs without errors, gives correct amounts, handles bad input kindly, and has a README that shows how to run it.