AssignmentsWeek 01 · FoundationsMobile money fee calculator
wk01.p2Practice exerciseWeek 01 · FoundationsOpen · due in week 1

Mobile money fee calculator

Practice if / elif / else by working out the fee for sending mobile money. The math is honest, the decisions branch three ways.

What you'll build

Practice if / elif / else by working out the fee for sending mobile money. The math is honest, the decisions branch three ways.

Requirements

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

  1. Ask the user how much money they want to send, then convert the answer to a float.
  2. Calculate the fee using these rules: under GHS 100 = GHS 1 flat. From GHS 100 to GHS 499.99 = 1% of the amount. GHS 500 and above = GHS 6 flat.
  3. Print the amount, the fee, and the total the sender will pay — each on its own line.
  4. If the amount is zero or negative, print a friendly message and stop without crashing.
Bonus, if you're feeling brave
  • Ask whether the recipient is on the same network (yes/no). If no, double the fee.
  • Round the fee to two decimal places so the output looks like money.

Examples

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

Example 1 — small send
$ python momo_fee.py
How much do you want to send (GHS)? 40
Amount: 40.0
Fee: 1.0
Total to pay: 41.0
Example 2 — bad input
$ python momo_fee.py
How much do you want to send (GHS)? -5
That amount doesn't make sense. Try again.

Where to start

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

momo_fee.py
# Mobile money fee calculator

amount_text = input("How much do you want to send (GHS)? ")
amount = float(amount_text)

if amount <= 0:
    print("That amount doesn't make sense. Try again.")
else:
    # TODO: work out the fee with if/elif/else
    fee = 0
    total = amount + fee
    print("Amount:", amount)
    print("Fee:", fee)
    print("Total to pay:", total)

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 runsHandles a normal send like GHS 200 without errors.1
Branches correctlyAll three bands (under 100, 100–499, 500+) produce the right fee.1
Handles bad inputZero or negative amounts get a calm message, not a crash.1
Readable outputThree labelled lines a normal person could understand.1
Ready?
Hand it in
You can submit a draft and revise later if you're not done.
Begin submission →