Stop 02 · Variables, Data Types & OperatorsProjects · 1/1

Bill Splitter Calculator

Part of the Python Roadmap

In short

Every group dinner ends with someone doing maths on their phone. This project turns that into a tiny program: enter the bill, GST, tip and number of friends, and get everyone's fair share in a neat summary.

A command-line calculator that asks for a restaurant bill in rupees, the tip percentage and the number of friends, then prints each person's share. It practises input, conversion, arithmetic and formatting.

The jaadu sits at a restaurant table with four friends, holding up a long paper bill and sliding equal piles of coins towards each plate.

Think of it like this

The friend who always settles the bill

In every friend group there is one person who collects the bill, adds the tax and tip, divides it properly and tells everyone exactly what to pay. Your script becomes that friend: it asks the same questions, does the same maths, and never forgets the GST.

Watch it happen

A ₹2,400 dinner for 4 friends, 5% GST, 10% tip

bill 2400
0
gst ?
1
tip ?
2
total ?
3
share ?
4

1/5The user enters the bill (₹2,400), GST %, tip % and number of friends.

The big ideas

What you need to know

Collect and convert

Read each value with input() and convert at once: float for money and percentages, int for the number of people.

One calculation per line

Give GST, tip, total and share their own named variables. It is easier to check, and easier to change later.

Format like a receipt

Use f-string alignment, like {label:<12} and {amount:>10,.2f}, so the rupee amounts line up in a column.

Show money with two decimals

₹690.00 looks like a bill. ₹690.0 looks like a bug.

See it in code

Walk through the code

python
1# bill_splitter.py2print("=== Bill Splitter ===")3 4bill = float(input("Bill amount (₹): "))5gst_percent = float(input("GST % (e.g. 5): "))6tip_percent = float(input("Tip % (e.g. 10): "))7people = int(input("Number of friends: "))8 9gst = bill * gst_percent / 10010tip = bill * tip_percent / 10011total = bill + gst + tip12share = total / people13 14print("-" * 30)15print(f"{'Subtotal':<12}₹{bill:>10,.2f}")16print(f"{'GST':<12}₹{gst:>10,.2f}")17print(f"{'Tip':<12}₹{tip:>10,.2f}")18print(f"{'Total':<12}₹{total:>10,.2f}")19print("-" * 30)20print(f"Each of {people} friends pays ₹{share:,.2f}")

1/5Four questions, each converted straight away to the type the maths needs.

With 2400, 5, 10 and 4 as inputs, the last line prints: Each of 4 friends pays ₹690.00

Save yourself the pain

Common mistakes

Oops

Forgetting to convert input and getting a TypeError when multiplying.

Do this instead

Wrap every numeric input in float() or int() as soon as you read it.

Oops

Entering 0 friends and crashing with ZeroDivisionError.

Do this instead

For now, note it as a known limitation. In the next phase you'll add an if check to reject it.

Oops

Printing raw floats like ₹573.3333333333334.

Do this instead

Always format money with :.2f (or :,.2f) when displaying it.

Your mission

Upgrade the splitter

~35 min

Quick check

Why is people read with int(input(...)) but bill with float(input(...))?

Go deeper

  1. 1Round each share to two decimal places with an f-string.
  2. 2Add GST as a separate line before the tip.
  3. 3Print a neat summary showing the subtotal, tax, tip and per-person amount.

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge