To put it simply, I'm currently learning to make function call. I want to level it up a bit by making simple main menu selection for desired function, while accepting user input.
But the problem is, the code is stuck without returning anything. I can input value for x and y but then the code stops processing the math equations.
print ("Select function : ")
print ("1. Addition")
print ("2. Substraction")
print ("3. Multiplication")
print ("4. Exit")
print ("")
z = input("Input your selection here : ")
x = int(input("Enter x value : "))
y = int(input("Enter y value : "))
def add(x,y):
return x + y
def min(x,y):
return x - y
def mult(x,y):
return x * y
loop = True
while loop:
if z == '1':
add(x,y)
elif z == '2':
min(x,y)
elif z == '3':
mult(x,y)
elif z == '4':
loop = False
Any advice to make it work? Thanks