I'm trying to create a program that uses random floats to perform an operation selected by the user. In the current set up, the program goes straight to printing "Quitting. Thank you for using my program!" regardless of which operation I choose.
print ( "This program performs mathematical functions with random numbers." )
op = input("Choose a math operation (Please type +, -, *, /, % to select an operation, or type q to quit ): ")
import random
random.randint(1,10)
random.random()*10
while (op != "q"):
if (op == "+"):
def add2(a,b):
print ("mathop called with",a,"and",b)
c=a+b
return c
elif (op == "-"):
def subtract2(a,b):
print ("mathop called with",a,"and",b)
c=a-b
return c
elif (op == "*"):
def multiply2(a,b):
print ("mathop called with",a,"and",b)
c=a+b
return c
elif (op == "/"):
def divide2(a,b):
print ("mathop called with",a,"and",b)
c=a/b
return c
elif (op == "%"):
def remainder2(a,b):
print ("mathop called with",a,"and",b)
c=a%b
return c
else:
print ("Quitting. Thank you for using my program!")
op = input("Choose a math operation (Please type +, -, *, /, % to select an operation, or type q to quit ): ")