Please i have a challenge at hand can some-one help?



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

this is the eg:

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.assertEqual(self.my_account.balance, 180, msg='Deposit method inaccurate')
  def test_withdraw(self):
    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')


Try to say what you want people to help with exactly :smile:
And one of the language specific categories might get you more responses than here.


We tend to shift all of these sorts of questions out of the exercise forums and over here.

edit: adding the language as a tag would be nice


I wasnt sure if the question was directly from an exercise, thats what I meant to say :smile:


Oh, right. I'm not 100% certain, but it doesn't sound familiar. It could be a Pro project that I haven't noticed yet.


This has come up a couple of times and I took it as a homework project, but it may be in the Pro tracks. Don't know for sure.


You might have it right there.



I've tagged it as homework now.


its actually a home-work exercise that i avent come-across in my life....u are right


thank you for your concern, i will check the link


ok please what is a 'balance' properties, in OOP


pls what is a balance properties in OOP, according to the question


do you have a link where a matter like this is discussed:
Create a function manipulate_data that does the following
Accepts as the first parameter a string specifying the data structure to be used "list", "set" or "dictionary"
Accepts as the second parameter the data to be manipulated based on the data structure specified e.g [1, 4, 9, 16, 25] for a list data structure
Based off the first parameter

return the reverse of a list or
add items `"UDOKA"`, `"UDO"` and `"NWOSU"` to the set and return the resulting set
return the keys of a dictionary.


I can't help with your entire project, but the people who can help will be more interested in giving you advice if you show them the work that you've done already.

At least show them that you have started ...

Reading what you just wrote about the assignment and picking out the base pieces:

Create a function manipulate_data ... that accepts two parameters ... and returns something

What would your code look like for just that much?

If you can't do that, then instead of posting all of these instructions from your assignment, you should instead be asking for help on how to write a function. There is a Python course here at Codecademy that includes how to write functions.