I'm new to python and I am still trying to get the hang of it. I'm attempting to change the processing function in the following code so that the user can not withdraw more money then what the "bank" has on record, which is 500. I was hoping that someone could help. Would I enter an if statement for >500?
#Simple Bank Atm
pin=int(input(“Please enter your PIN:”))
amt=float(input(“How much would you like to withdraw?”))
You can use an
if condition to do this.
if amt <= balance: #Can't withdraw over your current balance balance -= amt else: print("Error. Amount exceeds funds on record.")
Also, other things aside you're returning the same thing inside your
else condition and if this is what you really want to return it's redundant to have it in both. You can just have it after your else statement at the same indentation level