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...




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:



Function name<br>Description<br>parameter<br>Return type<br>main()<br>Handles<br>the<br>main<br>None<br>None<br>functionality of the code.<br>provided<br>Structure<br>in<br>template file<br>Calculates summation of<br>monthly_spending ()<br>spend_dict<br>dict<br>total spending per month<br>and populates<br>dictionary<br>a<br>new<br>called<br>month_spend_dict where,<br>each key is the name of the<br>month and the value is the<br>summation<br>of<br>total<br>spending per month. This<br>function returns the new<br>dictionary. You can use<br>sum<br>function<br>for<br>this<br>purpose.<br>max_spending()<br>Finds<br>the<br>maximum<br>month_spend_dict string, int<br>spending of the user from<br>month_spend_dict<br>dictionary. This function<br>returns the month with<br>highest spending and the<br>amount spent on that<br>month.<br>

Extracted text: Function name Description parameter Return type main() Handles the main None None functionality of the code. provided Structure in template file Calculates summation of monthly_spending () spend_dict dict total spending per month and populates dictionary a new called month_spend_dict where, each key is the name of the 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.

Jun 02, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here