I want to print "yes" when the user writes "y" and print"no" when the user writes "n" in "Are you sure for the exit" question. And the second problem is; if I write any letter instead of "y" or "n", the code is still running. How to fix it?
residuary = 1000
while True:
operation = input("Select operation: ")
if(operation == "q"):
print("Are you sure for exit? (y/n)")
answer = input("Answer:")
y = "yes"
n = "no"
if(answer == "y"):
print("See you again ")
break
else:
continue
elif(operation== "1"):
print("Residuary is ${} .".format(residuary))
elif (operation== "2"):
amount = int(input("Amount you want to invest: "))
residuary += amount
print("${} sent to account.".format(amount))
print("Available Residuary ${} ".format(residuary))
elif (operation == "3"):
amount = int(input("Amount you want to withdraw: "))
if(amount > residuary):
print("You can not withdraw more than available residuary!")
continue
residuary -= amount
print("${} taken from account.".format(amount))
print("Available Resiaduary ${} ".format(residuary))
else:
print("Invalid Operation!")