CALCULATOR

 PROGRAM:

def add(x,y):

    return(x+y)

def subract(x,y):

    return(x-y)

def multiply(x,y):

    return(x*y)

def divide(x,y):

    return(x/y)

def calculator():

    while True:

        print("1.ADDITION")

        print("2.SUBRACTION")

        print("3.MULTIPLY")

        print("4.DIVIDE")

        choice=int(input("Enter your choice:"))

        x=int(input("Enter Your Number:"))

        y=int(input("Enter Your Number:"))

        if(choice==1):

             print("addition:",add(x,y))

        if(choice==2):

             print("subraction:",subract(x,y))

        if(choice==3):

             print("multiply:",multiply(x,y))

        if(choice==4):

            print("divide:",divide(x,y))

        else:

            print("Invalid choice")

calculator()

                            

                            

                    

OUTPUT:


Comments

Popular posts from this blog

Bus Booking Application using Tkinter (Python GUI)

ATM Simulation using Python and Tkinter GUI

Healthcare Chatbot Using Tkinter GUI in Python