Click here to Skip to main content
15,888,816 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm creating python ATM for my project, and I need to Update the Balance every time I withdraw and Deposit. However, when I withdraw then check the balance, the balance does not update. Same thing when I withdraw or deposit. How do I update the Balance every time I withdraw and Deposit?

ATM.py - Google Drive[^]

What I have tried:

ATM.py - Google Drive[^]
Posted
Updated 24-Feb-21 22:16pm

The typical impression one gets of students is that they are lazy, unwilling to do their own homework because it impacts on valuable drinking time, and generally offensive to be around. But ... trying to be rude to people you want help from? Not a great idea, even for a student so when one calls himself "FU_..." and asks a "question" like this it's pretty clear that he fits the stereotype pretty well.

Do you really think that everybody here has the time and inclination to wade through a pile of student grade Python code to try and work out what is going on and what might be relevant and what isn't? And then to make sure that nobody can actually read it at all?

Help us to help you: change your username to reflect who you are, copy'n'paste the relevant parts of your code into your question so we can get to them immediately, and explain what you have tried and what happened when you did.
We aren't here to do your homework for you!
 
Share this answer
 
Comments
Blutfaust 25-Feb-21 2:35am    
Well, "FU" could also mean "Freie Universität" like in https://www.fu-berlin.de/
OriginalGriff 25-Feb-21 2:40am    
It is possible, but ... he's in the US, apparently, and trying to hide his identity so his teacher can't spot how much work he actually did for himself. :D
Not too difficult ...
Python
def deposit(amount):
    global balance
    balance += amount

def withdraw(amount):
    global balance
    balance -= amount

global balance
balance = 1000;
deposit(27)
print(balance)
withdraw(400)
print(balance)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900