I am a beginner. I am creating a very basic calculator.
I want to break the program when the user gives the command as "STOP". Here's my code:
while d=="yes" or d=="YES" or d=="Yes":
a=input("Enter: A for additon, B for Subtraction, C for Multiplication, D for Division: ")
b=int(input("Enter the first number: "))
c=int(input("Enter the second number: "))
if a=="A":
print(b+c)
elif a=="B":
print(b-c)
elif a=="C":
print(b*c)
elif a=="D":
print(b/c)
elif a=="STOP":
break
I tried typing "STOP" but the output comes like this:
Do you want to calculate more? YES
Enter: A for additon, B for Subtraction, C for Multiplication, D for Division: B
Enter the first number: 46
Enter the second number: 23
23
Enter: A for additon, B for Subtraction, C for Multiplication, D for Division: STOP
Enter the first number: 1
Enter the second number: 23
After it receives the input "STOP", it asks for the first and the second number again which are the b and c variables. Either it should ask again to calculate more, or it should terminate upon the user's request. How can I make the changes??