I am not sure whether to use try/except or an if condition to detect whether a number is an int or a float. I know my input is either a float or an int, and I want to raise a value error for all floats, and do something if the number is an int. An example of where this type of behavior might be seen is a factorial... However, I don't want a 5.0 to be converted to a 5. What is the best approach?
factorial(5)
> 120
factorial(asdf)
> ValueError
factorial(5.0)
> ValueError
I read this question Parse String to Float or Int but I am still confused