Here is the code (python):
def is_integer(num):
if isinstance(num, float):
return num.is_integer()
elif isinstance(num, int):
return True
else:
return False
I'm not sure how returning num.is_integer works and how that makes the function able to distinguish 10.0 from 10.1, as the functions purpose is to determine if the number is unnecessarily made into a float when it should be an int by determining if the number has unnecessary decimal points of 0 as a float. How does returing num.is-integer work to determine if the number has a .0 if the number is a float?