Two bank account: current and saving. User has to be asked to choose one, then withdraw money. How can I do a decrement of the balance each time I loop in this function?? if balance = 10 euro , withdraw 5 so remaining is 5. User is asked to quit or continue , if continues the new withdrawal will be deducted from the new balance 5 euro not from 10 Euro.??? Could do all code but no idea how to let the decrement from new balance?????

4 Months
Discussion Span
Last Post by James Paul

You must have the following functions, balance(), deposit (), withdraw(). The deposit and withdraw functions should always call and return the balance. For deposite, call the balance function and add the deposited amount to the balance. For withdrawal, call the balance account, make the code to make sure that the amount to be withdrawn is less than the balance. If there is enough balance, then withdraw by substracting the amount from the balance. Return the balance.

Hint: The balance should have self as the only argument ,ie def balance(self), the deposite should have self and amount as arguments, ie def deposit(self, amount), the withdraw functions should have self, and amount ie, def withdraw(self, amount)
The deposit() and withdraw() fuctions should both call the balance() function work on it by eithing adding amount to it in case of deposit or substracting amount from it in case of withdrawal. Both deposit() and withdraw() functions must return the balance.

Edited by James Paul: spelling

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.