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?????

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.