Speed up development with full-stack environments for every branch.

Learn More

Basic Python Calculator [simple and beginner]

6076 Runs 43309 Views 13281 Copies

Simple calculator made using beginner knowlage

Saved

Saved

mentos1386 2

mentos1386
published 3 years ago

#My first program in Python. Im still learning this programing language.

running = True 

while running:
    print("1 = Addition")
    print("2 = Subtraction")
    print("3 = Multiplication")
    print("4 = Division")
    print("5 = Exit program")
    cmd = int(input("Enter number : "))
    if cmd == 1:
        print("Addition")
        first = int(input("Enter first number :"))
        secund = int(input("Enter secund number :"))
        result = first + secund
        print(first ,'+' ,secund ,'=' , result)
    elif cmd == 2:
        print("Subtraction")
        first = int(input("Enter first number :"))
        secund = int(input("Enter secund number :"))
        result = first - secund
        print(first ,"-" ,secund ,"=" , result)
    elif cmd == 3:
        print("Mmltiplication")
        first = int(input("Enter first number :"))
        secund = int(input("Enter secund number :"))
        result = first * secund
        print(first ,"*" ,secund ,"=" , result)
    elif cmd == 4:
        print("Division")
        first = int(input("Enter first number :"))
        secund = int(input("Enter secund number :"))
        result = first / secund
        print(first ,"/" ,secund ,"=" , result)
    elif cmd == 5:
        print("Quit!")
        running = False
Please login/signup to get access to the terminal.

Your session has timed out.

Dismiss (the page may not function properly).