"A problem with option reference". Problems with Basic Calculator code

  python

I am fairly new to python. I can’t find out what really is the problem here. I am coding a basic calculator that asks for two inputs; ‘firstnum’ and ‘secondnum’. Then, a numbered options list is outputted. The user then picks one number from 1-4. Based on that and the inputs, a calculation is performed. After that, I want to ask the user if they want to continue with further operation (loop) but that is when the loop is broken. So, I want the code to go back to the while loop after it has broken. So, if 6 is pressed it will go back to the while loop. If 7, exit code.

print("Hello, welcome to my calculator")
firstnum = int(input("Enter your first number"))
secondnum = int(input("Enter your second number"))
def loop(

        while True:
                Options = int(input('''
                       1 is Addition
                       2 is Subtraction
                       3 is Multiplication
                       4 is Division
        
                           '''))
                if Options ==1:
                        print("The total is", firstnum + secondnum)
                elif Options ==2:
                        print("The total is", firstnum - secondnum)
                elif Options ==3:
                        print("The total is", firstnum*secondnum)
                elif Options ==4:
                        print("The total is", firstnum/secondnum)

                break

print("Would you like to continue?")
ask = int(input('''
        6 for Yes
        7 for No
                '''))
if ask ==6:
                continue

elif ask ==7:
        exit

Source: Python Questions

LEAVE A COMMENT