Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

creat a new EnhancedBudget class, do the following: add a new class attribute, transactions. This should be initialized when the EnhancedBudget is created and should

creat a new EnhancedBudget class, do the following:

  • add a new class attribute, transactions. This should be initialized when the EnhancedBudget is created and should default to being an empty dictionary ({}). This dictionary will have budget categories as its keys and the values associated with each key will be a list of the transactions (in dollars) logged for that category.
  • add a new class method, log_transaction, that takes two inputs: category and amount. Using these two inputs, this method should for the following:
    1. Check to see if the provided category is already in the transactions dictionary.
    2. If it is, it should append the amount to the list of amounts that already exist in that category.
    3. If it isn't already in the transactions dictionary, it should create a new list associated with that category key with the amount as the first entry in the list.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Quantitative Analysis Of Finance And Accounting - New Series

Authors: Lee Cheng Few

2nd Edition

9812386696, 9789812386694

More Books

Students also viewed these Accounting questions

Question

How is coaching similar to counseling? How are the two different?

Answered: 1 week ago