Question: Please answer question 8.40 Python 3.0 for language Comment for each part of line of code explaining what is being done 8.40 In Problem 8.20,
8.40 In Problem 8.20, there are some problems with the implementation of the class BankAcours and they are illustrated here: xBankAccount (-700) >>>x.balance() -700 >>>x.withdraw(70) >>>x.balance () -770 >>>x.deposit(-7) >>>x.balance ) Balance: -777 The problems are: (1) a bank account with a negative balance can be created, (2) the with- drawal amount is greater than the balance, and (3) the deposit amount is negative. Modify the code for the BankAccount class so that a ValueError exception is thrown for any of these violations, together with an appropriate message: 'Illegal balance', 'Overdraft',or Negative deposit
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
