Question: I am having trouble getting my code to calculate the rest of my program in python. I can get it to say my first statement
I am having trouble getting my code to calculate the rest of my program in python. I can get it to say my first statement and ask for the ranges and values, but when running the program it wont spit out the calculations or the statements that should populate after inputting the initial data. The following is what is coded for my assignment. What am I missing here?
print("This is my third assignment")
minRange = float(input("Enter your Lower Range"))
maxRange = float(input("Enter your Higher Range"))
x = float(input("Enter your First Number"))
y = float(input("Enter your Second Number"))
def add(x, y):
return x + y
def subtract(x, y):
return x - y
def multiply(x, y):
return x * y
def division(x, y):
if y == 0:
return "ZERO IS NOT DIVISABLE"
else:
return str(x / y)
if x < minRange or y < minRange:
print (" The input values are less than minimum range Please check the numbers and try again ")
elif x > maxRange or y > maxRange:
print (" The input values are greater than maximum range Please check the numbers and try again ")
else: print(" The Result of " + str(x) + "+" + str(y) + "=" + str(add))
print(" The Result of " + str(x) + "-" + str(y) + "=" + str(subtract))
print(" The Result of " + str(x) + "*" + str(y) + "=" + str(multiply))
print(" The Result of " + str(x) + "/" + str(y) + "=" + division(x, y))
print(" THANK YOU FOR USING MY CALCULATOR!")
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
