Function name Description parameter Return type main() Handles the main None None functionality of the code. provided in Structure template file Calculates summation of spend_dict total spending per month and populates dictionary month_spend_dict where, each key is the name of the monthly_spending () dict a new called month and the value is the summation of total spending per month. This function returns the new dictionary. You can use sum function for this purpose. max_spending() Finds the maximum month_spend_dict string, int spending of the user from month_spend_dict dictionary. This function returns the month with highest spending and the amount spent on that month.
python program that allows a user to track spending in three categories per month and return the
highest spending among all the months. The three categories are: rent, grocery, and utilities. A
dictionary spend_dict, provided in the template file, holds the monthly expenditure for categories.
spend_dict contains the name of month as key and value is a list of expenditure in three categories. For
example: user spent $90 in grocery category in the month of January.
spend_dict = {'Jan': [90,60, 50], 'Feb': [56, 30, 65], 'Mar': [100, 85, 78]}
For this pyhton program, i want to find the user’s maximum expenditure from the given months.
Lab Scenario:
The template file contains a dictionary as described above. You need to define the following functions
as below:
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images