So, if user inputs:

num1 = 2.0

num2 = 1.0

answer = 1.0

I wonder, if there is a way where I could determine if is a whole number?

def division(num1, num2): answer = num1/num2 return answer while(True): try: num1 = float(input("Enter a value for denominator.")) num2 = float(input("Enter a value for numerator.")) answer = division(num1, num2) print(num1, "/", num2, "=", answer) break except ValueError: print ("Oops! That was not a valid number.") except ZeroDivisionerror: print ("Oops! You cannot divide by zero.")