Using the variable 4 as an example, the result of 2.0 is clearly a float. I have no idea why it triggers my first if statement. Is it because square_root is a reference to the variable and not actually 2.0? I am expecting to take complex numbers and I need "is not isinstance" to work properly.
square_root = 4 ** (1/2)
if square_root != isinstance(square_root,float):
return False
if square_root.is_integer():
return True
else:
return False