What you'll build
Total a list of application fees with a loop. Practice the start-at-zero, add-one-at-a-time pattern you'll reuse all term for counting and averaging.
Requirements
The must-do parts. If any are missing, we'll ask you to take another pass.
- Make a list of at least four application fees (numbers, in any currency you like).
- Start a
totalat0, then use aforloop to add each fee on top, one at a time. - After the loop, print the total clearly on its own line.
- Do not add the numbers by hand — the loop must do the totalling.
Bonus, if you're feeling brave
- Also print the average — the total divided by
len()of the list. - Print the most expensive fee. Start a
highestat0and, inside the loop, replace it whenever you find a bigger one.
Examples
What your program should look like when it runs. Lines starting with $ are typed by you; the rest is your program.
Example cell runs
Total application fees: 275Where to start
Copy this scaffold into a new file. You don't have to use it — it's just a friendly nudge.
# Application fee tally
fees = [50, 75, 60, 90] # TODO: make these your own
total = 0
# TODO: use a for loop to add each fee to total
# TODO: print the totalHow we'll grade it
Four checks, four points. Three or above is passing — we'll ask you to revise anything we can't tick.
| Check | What we look for | Pt |
|---|---|---|
| It runs | Starts cleanly and prints a total without errors. | 1 |
| Loop does the work | A `total` starts at 0 and a `for` loop accumulates it — the answer is not hardcoded or added by hand. | 1 |
| Total is correct | The printed total matches the sum of the list. Change a fee and it should still be right. | 1 |
| Reads well | The total is on its own line, labelled in plain English. | 1 |