I am writing a code where there is a 'while loop' that has an input that asks the user to choose one of the mentioned options. But I am having a problem that no matter what the user inputs, the if statement does the same output again and again.
This is the code:
while infinite == 1:
what_do = input("What do you want to do?\n\nIf you want to deposit money say- Deposit\n\nIf you want to withdraw money say- Withdraw\n\nIf you want to see Account Info say- Account Info\n\nIf you want to see the balance say- Balance\n\nIf you want to leave say- Exit\n\nWhat to do: ")
if what_do == "Deposit" or "deposit":
dep = int(input("How much would you like to deposit? "))
acc1.deposit(dep)
elif what_do == "Withdraw" or "withdraw":
wit = int(input("How much would you like to withdraw? "))
acc1.withdraw(wit)
elif what_do=="Account Info" or "account info":
acc1.show_acc_info()
elif what_do=="Balance" or "balance":
acc1.show_balance()
elif what_do=="Exit" or "exit":
break
else:
break
This is the output:
Welcome to the bank
Would you like to make a new account: ya
Enter your name: Someone
Enter your age: 12121
Enter your gender: something
Enter your mobile number: 1212121212
What do you want to do?
If you want to deposit money say- Deposit
If you want to withdraw money say- Withdraw
If you want to see Account Info say- Account Info
If you want to see the balance say- Balance
If you want to leave say- Exit
What to do: Account Info
How much would you like to deposit? 12
The new balance is: 12
What do you want to do?
If you want to deposit money say- Deposit
If you want to withdraw money say- Withdraw
If you want to see Account Info say- Account Info
If you want to see the balance say- Balance
If you want to leave say- Exit
What to do: Withdraw
How much would you like to deposit? 12
The new balance is: 24
Would be nice if you could help me.
Aucun commentaire:
Enregistrer un commentaire