I'm making a ATM-type program in which I have to ask the user if they want to deposit, withdraw, or check their balance in their savings or checking account, but only if the pin they enter is 1234. I've been instructed to use global variables and initialize savings and checking as 0. All of my functions are working properly, but when the program loops again the savings and checking balances are still 0, even when the user has just deposited money into either account. I'm not sure which part of my code is messing this up, but any help is greatly appreciated.
#Create global variables
Checking = 0
Saving = 0
def main():
pin_number = input("Please enter your pin number ")
stop = False
while not is_authorized(pin_number) and stop!= True:
if pin_number == "0":
stop = True
if pin_number == "1234":
stop = False
if stop != True:
while True:
choice = display_menu()
if choice == 1:
deposit()
elif choice == 2:
withdraw()
elif choice == 3:
check_balance()
def is_authorized (pin_number):
if pin_number == "1234":
return True
else:
return False
def display_menu():
print('1) Deposit')
print('2) Withdraw')
print('3) Check amount')
choice = int(input("Please enter the number of your choice: "))
return choice
def deposit():
depositing=str(input("Would you like to deposit into your savings
or checking? "))
if depositing == "savings":
depo = float(input("How much would you like to deposit? "))
new_savings = Saving + depo
print ("Your new balance is" +str (new_savings))
elif depositing == "checkings":
depo = input(int("How much would you like to deposit? "))
new_checking = Checking + depo
print ("Your new balance is" +str (new_checking))
def withdraw():
print ("Your savings account balance is " +str (Saving))
print ("Your checkings account balance is " +str (Checking))
withdrawing=str(input("Would you like to withdraw from your checking or savings? "))
if withdrawing == "checking":
withdraw = int(input("How much would you like to withdraw? "))
checking2= Checking - withdraw
print ("Your new balance is" +str (checking2))
elif withdrawing == "savings":
withdraw = int(input("How much would you like to withdraw? "))
savings2= Saving - withdraw
print ("Your new balance is" +str (savings2))
def check_balance():
checkbalance= input("Would you like to check your savings or checking? ")
if checkbalance == "savings":
print (Saving)
elif checkbalance == "checking":
print ("Your balance is $" +str (Checking))
main()