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:
![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.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fd3e9f1d5-ad97-4cda-ad1a-57193b42f221%2F6deafb98-c469-4cf7-95c3-be58930b8716%2Fvpjrdi8_processed.jpeg&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)