What you will learn
Combine dictionaries, loops, formatting and aggregation in a small project.
Practise
Read expenses from input, reject negative values and save the summary as JSON.
Combine dictionaries, loops, formatting and aggregation in a small project.
Read expenses from input, reject negative values and save the summary as JSON.
Experiment with the program below. Your code and input are sent to the selected compiler only when you run it.
Tab indents · Shift+Tab unindents · Esc then Tab leaves the editor · Ctrl/Cmd+Enter runs · Ctrl/Cmd+S saves a draft
Changes save automatically to your account.
No input required.Expected output for the original program
Travel: INR 450.00 Food: INR 275.50 Total: INR 725.50
Output will appear here.
Educational simulation — object identities and execution steps are illustrative.