I just wanted to know if this calculator technically has an algorithm
import sys
#Start of defined varibles
options = {1, 2, 3, 4}
def addition (x, y):
print ("Your answer is", x+y,"!")
def substraction (x, y):
print ("Your answer is", x-y,"!")
def multiplication (x, y):
print ("Your answer is", x*y,"!")
def division (x, y):
if y == 0:
print ("You cannot divide by 0. Please try again")
exit()
else:
print ("Your answer is", x/y,"!")
#End of defined variables
print ("Hello, welocome to your personal calculator")
operation = (int(input("What operation would you like to do today? \n \n 1. Addition \n 2. Substraction \n 3. Multiplication \n 4. Division \n")))
if operation in options:
x = int(input("What is the first number you would like to use\n"))
y = int(input("What is the second number you would like to use\n"))
if operation == 1:
addition(x, y)
if operation == 2:
substraction(x, y)
if operation == 3:
multiplication(x, y)
if operation == 4:
division(x, y)
else:
print ("Your option is not available please try again")
exit()```