Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

All code must be commented appropriately. All variable and class names must be followed. Any variable names not specified in this document must be descriptive.

image text in transcribed
All code must be commented appropriately. All variable and class names must be followed. Any variable names not specified in this document must be descriptive. Proper Pythonic formatting must be followed. ErrorHandling.py Create a class called BankAccount with the following attributes: - The __init_method should take an initial balance and default to 0 if nothing is entered transaction_history should be initialized as blank list. - Setup the get_balance, set_balance, get_transaction_history, and set_transaction_history methods as getters and setters for their respective variables. - set_balance method should assert that whatever balance is being set is greater than - 1 - deposit method should assert that whatever amount that's given is greater than 0 . - withdraw method should assert that whatever amount is being withdrawn is not greater than balance. - Above methods should ensure that an integer is passed, and if not then raise a TypeError along with a message "You must enter a number ". - The transaction_history variable should be a list that records every transaction that is made (i.e., when an amount is deposited, append the deposited amount, when an amount is withdrawn, append the negative withdrawn amount), Ex. [ 100,100,200,50] - get_avg_transaction method should first assert that the transac>on_history is not empty. From there it should cycle through the history, adding up all of the numbers, and then find and return the average

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_2

Step: 3

blur-text-image_3

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

Database Processing

Authors: David Kroenke

11th Edition

0132302675, 9780132302678

More Books

Students also viewed these Databases questions