Project: Tip Calculator
Restaurant math is a perfect first calculator. In this project you will build a tip calculator that takes a bill amount, a tip percentage, and a number of people, then works out the tip, the total, and how much each person owes.
What You'll Build
- Inputsbill, tip %, people
- Calculatetip, total, split
- Print receiptformatted money
Step 1: The Inputs
Store the three inputs in variables. Later you could read these from a user, but for now we set them directly so the result is predictable:
Step 2: Do the Math
The tip is the bill times the percentage divided by 100. The total is the bill plus the tip. The per-person amount is the total divided by the number of people:
Notice per_person has a long trail of decimals. Money should show only two, so we format it in the next step.
Step 3: Format Like Money
Use :.2f inside f-strings so every amount shows exactly two decimal places.
Build It Yourself
Produce the exact three-line receipt below using bill = 48.50, tip_percent = 18, and people = 3.
Make It Your Own
Change the bill, tip, or number of people and rerun. Try a 20% tip on a $75 bill split between 4 people:
Challenge Ideas
- Round each person's share up so the tip is never short (look up
math.ceil) - Print the tip percentage in the receipt heading
- Add a line for the bill before tip so the receipt is complete
Key Takeaways
- Break a calculation into named steps:
tip,total,per_person / 100turns a percentage into a fraction- Format currency with
f'${value:.2f}' - Changing the inputs instantly changes the output, which is what makes it a tool

