AssignmentsWeek 01 · FoundationsStudy-group bill split
wk01.p9Practice exerciseWeek 01 · FoundationsOpen · due in week 1

Study-group bill split

After a study-group hangout, ask for the total bill and the number of people. Divide. Print a clean three-line receipt. Practice mixing int() and float() with division.

What you'll build

After a study-group hangout, ask for the total bill and the number of people. Divide. Print a clean three-line receipt. Practice mixing int() and float() with division.

Requirements

The must-do parts. If any are missing, we'll ask you to take another pass.

  1. Ask the user for the total bill in GHS (a decimal is allowed) and the number of people sharing it.
  2. Convert the bill with float() and the people count with int().
  3. Calculate how much each person pays.
  4. Print three labelled lines: the bill, the number of people, and the per-person amount.
Bonus, if you're feeling brave
  • Ask if the group wants to add a 10% tip and include it before splitting.
  • Round the per-person amount to two decimal places with round(..., 2).

Examples

What your program should look like when it runs. Lines starting with $ are typed by you; the rest is your program.

Example cell run
Total bill (GHS): 240
Number of people: 4

Bill: GHS 240.0
People: 4
Each person pays: GHS 60.0

Where to start

Copy this scaffold into a new file. You don't have to use it — it's just a friendly nudge.

# Study-group bill split

bill_text = input("Total bill (GHS): ")
people_text = input("Number of people: ")

# TODO: convert bill_text to float and people_text to int
# TODO: calculate how much each person pays
# TODO: print three labelled lines

How we'll grade it

Four checks, four points. Three or above is passing — we'll ask you to revise anything we can't tick.

CheckWhat we look forPt
It runsAsks both questions, prints three labelled lines without errors.1
Conversions are right`float()` for the bill and `int()` for the people count.1
Math is rightPer-person amount equals bill divided by people.1
Readable outputThree labelled lines, easy to glance at.1
Ready?
Hand it in
You can submit a draft and revise later if you're not done.
Begin submission →