Help please solve this problem

homework
python

#1

Please, what is the solution to this python code:

OOP LAB Create a class called BankAccount

Create a constructor that takes in an integer and assigns this to a balance property. Create a method called deposit that takes in cash deposit amount and updates the balance accordingly. Create a method called withdraw that takes in cash withdrawal amount and updates the balance accordingly. if amount is greater than balance return "invalid transaction" Create a subclass MinimumBalanceAccount of the BankAccount class

import unittest class AccountBalanceTestCases(unittest.TestCase): def setUp(self): self.my_account = BankAccount(90)

def test_balance(self): self.assertEqual(self.my_account.balance, 90, msg='Account Balance Invalid')

def test_deposit(self): self.my_account.deposit(90) self.assertEqual(self.my_account.balance, 180, msg='Deposit method inaccurate')

def test_withdraw(self): self.my_account.withdraw(40) self.assertEqual(self.my_account.balance, 50, msg='Withdraw method inaccurate')

def test_invalid_operation(self): self.assertEqual(self.my_account.withdraw(1000), "invalid transaction", msg='Invalid transaction')

def test_sub_class(self): self.assertTrue(issubclass(MinimumBalanceAccount, BankAccount), msg='No true subclass of BankAccount')

Thank you.....


#2

There is a similar post HERE


#3

@rydan, do you know what module this is from? It's not in the Python track.


#4

@mtf yeah I tried to search for it on codeacademy but I coudnt' find it . I think it has nothing to do with any courses on codeacademy


#5

Thanks for looking. It's in the right forum, then.