import time
#Initializing Variables
currentMoney = 0
depositedMoney = 0
takenMoney = 0
#Main Fucntion which shows when the program starts
def Main():
while True:
userChoice = input("Welcome to the ATM Organizer. To Preceed Enter 1 To Close Enter 0")
if userChoice == 1:
Atm()
elif userChoice == 0:
print("Thank you.Good Bye!")
break
def Atm():
Handling Invalid Inputs
while True:
try:
atm = int(input("Welcome Inside The ATM , To See your money , Type '1' , To put money to the cash machine , Type '2' , To take money out of the ATM , Type '3' , To Exit the ATM , Type '0' ."))
except ValueError:
print("You didn't choose what was given!")
continue
Input Choices
if (atm == 0):
Main()
elif (atm == 1):
print("You Have ",currentMoney," Inside your account.")
break
elif (atm == 2):
money = int(input("How Much money do you want to deposit? "))
depositedMoney+=money
currentMoney=depositedMoney
print("You Have ",currentMoney," Inside Your Account")
break
elif (atm == 3):
while True:
takeMoney = int(input("How much money do you want to take? "))
if (takeMoney > currentMoney):
print("You don't have that value.")
continue
else:
print("LOADING...")
time.sleep(3)
takenMoney+=takeMoney
print("You've taken ",takenMoney," , You now have "(currentMoney-takenMoney," In your account")
break
Main()
arbeitet Jedes Mal, wenn ich versuche, es zu laufen, es wird hervorgehoben, dass über „Pause“, wenn ich es löschen, ein weiterer Fehler taucht auf, der "Main()" beim letzten Code ist, "und" macht es weiter ...Ich weiß nicht, was hier los ist, und ich versuchte fast alles, aber es will noch nicht
Ich hoffe, ich kann eine Antwort finden.
Fragen Debuggen Hilfe suchen (** "? Warum nicht dieser Code funktioniert" **) muss das gewünschte Verhalten umfassen, * ein bestimmtes Problem oder Fehler * und * die Kürzester Code erforderlich * um ihn ** in der Frage selbst zu reproduzieren **. Fragen ohne ** eine klare Problemstellung ** sind für andere Leser nicht nützlich. Siehe: [Erstellen eines minimalen, vollständigen und überprüfbaren Beispiels] (http://stackoverflow.com/help/mcve). – MattDMo