Selam’s Wallet
Python
20 pts
Selam’s Wallet
Selam has 200 Nakfa in her wallet.
- Create
balance = 200and print it. - She buys bread for 25 Nakfa. Reassign
balanceusing its old value (balance = balance - 25) and print it. - Her brother Merhawi gives her 50 Nakfa. Reassign
balanceagain and print it. - Create
total_spentwith the value25.
Expected output:
200 175 225
Checklist
- Update
balanceafter each event, reusing its old value, so it ends at 225. - Print
balanceat the start and after each change. - Create
total_spentfor the money Selam spent.
🔑 Solution
If you view the solution before passing, you earn half points for this exercise. You still need to type it and press Check to finish.
How it works, step by step
Point at a step to highlight its lines. Type the solution yourself and press Check answer to finish.
