Check if a Float value is equivalent to an Integer value | Function to check if N is equivalent to an integer ; Convert float value of N to integer ; If N is not equivalent to any integer ; Driver Code
def isInteger ( N ) : NEW_LINE INDENT X = int ( N ) NEW_LINE temp2 = N - X NEW_LINE if ( temp2 > 0 ) : NEW_LINE INDENT return False NEW_LINE DEDENT return True NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT N = 1.5 NEW_LINE if ( isInteger ( N ) ) : NEW_LINE INDENT print ( " YES " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " NO " ) NEW_LINE DEDENT DEDENT