Program for Menu Driven Caluclator in Python

Menu Driven Calculator



print("\n ***** Menu Driven Calculator ***** ")
while(True):
    print("\n 1. Addition \n 2. Subtraction \n 3. Multiplication \n 4. Divison \n 5. Exit")
    choice = int(input("  Enter Your Choice = "))
    if(choice == 1):
        num1 = int(input("\n Enter First Number = "))
        num2 = int(input("\n Enter Second Number = "))
        result = num1+num2
        print("\n Result ",result)
    if(choice == 2):
        num1 = int(input("\n Enter First Number = "))
        num2 = int(input("\n Enter Second Number = "))
        result = num1-num2
        print("\n Result ",result)
    if(choice == 3):
        num1 = int(input("\n Enter First Number = "))
        num2 = int(input("\n Enter Second Number = "))
        result = num1*num2
        print("\n Result ",result)
    if(choice == 4):
        num1 = int(input("\n Enter First Number = "))
        num2 = int(input("\n Enter Second Number = "))
        result = num1/num2
        print("\n Result ",result)
    if(choice == 5):
        print("\n Please Enter Valid Choice ")






Comments