Jan-22-2021, 04:32 PM
(This post was last modified: Jan-22-2021, 04:32 PM by beginner721.)
Hello everyone.. I have a problem
I have two Same Code but One of them Doesnt Work
This is the one that doesnt work
I've been working for hours for this.
I have two Same Code but One of them Doesnt Work
This is the one that doesnt work
balance=1000
## 1= BALANCE CHECK
## 2= deposit money
## 3= withdraw money
## q= exit
while True:
operation= input("Choose Operation:")
if (operation == "q"):
print("signing out...")
break
elif (operation == "1"):
print("current balance: ",balance)
elif (operation == "2"):
money = int(input("amount deposited: "))
balance += money
print("current balance: ",balance)
elif (operation == "3"):
money = int(input("the amount you want to withdraw: ")
if (balance-money<0):
print("You dont have enough money")
continue
balance -= money
else:
print("Invalid operation, (choose 1,2 or 3")but this code is working even though both are same balance=1000
## 1= BALANCE CHECK
## 2= deposit money
## 3= withdraw money
## q= exit
while True:
operation = input("Choose Operation:")
if (operation == "q"):
print("signing out...")
break
elif (operation == "1"):
print("current balance: ", balance)
elif (operation == "2"):
money = int(input("amount deposited:"))
balance += money
print("current balance: ", balance)
elif (operation == "3"):
money = int(input("the amount you want to withdraw:"))
if (balance - money < 0):
print("You dont have enough money")
continue
balance -= money
else:
print("Invalid operation, (choose 1,2 or 3")Please help me ......
I've been working for hours for this.
