def add(a,b):
return a + b
def subtract(a,b):
return a - b
def multiply(a,b):
return a * b
def divide(a,b):
return a // b
print("\t\t\tFUNCTION CALCULATOR")
print("1.Add\n2.Subtract\n3.Multiply\n4.Divide")
choice = input("Enter your operation (1/2/3/4/):")
if choice not in ["1","2","3","4"]:
print("Error: Invalid Operator!")
try:
num1= float(input("Enter the first number"))
num2= float(input("Enter the second number"))
if choice == "1":
result= add(num1,num2)
print("The sum of two numbers is:", result)
elif choice == "2":
result= subtract(num1,num2)
print("The difference between two numbers is:", result)
elif choice == "3":
result= multiply(num1,num2)
print("The multiplication of two numbers is :", result)
elif choice =="4":
result= divide(num1,num2)
print("The division of two numbers is:", result)
except ValueError:
print("Error: Invalid Input! Please Enter Numbers Only!")
except ZeroDivisionError:
print("Error: Division by zero Is Not Possible!")
To embed this project on your website, copy the following code and paste it into your website's HTML: