Basic Calculator using Python

Basic Calculator using Python


 Hello Friends
Welcome today...
Today we are create calculator using python code which is used to do addition, subtraction, multiply & division for only two numbers


This is code is very easy...


CODE:

try:
    n1 = float(input("Enter 1st number: "))
    n2 = float(input("Enter 2nd number: "))
    op = input("Enter operator number: ")

    if op == "+":
        print(n1 + n2)
    elif op == "-":
        print(n1 - n2)
    elif op == "*":
        print(n1 * n2)
    elif op == "/":
        print(n1 / n2)
    else:
        print("Invalid operator")
except:
    print("Invalid Input")


-------

By
PyKAR



 

Comments

Popular posts from this blog

Hardy - Ramanujan Number (Magic Number) Program in Python

FLAMES CODE ON PYTHON

Count Swap for Sorting in Python