Review: Built-In Functions --Getting an error message


I'm getting this error message at the bottom: Oops, try again. Your function seems to fail on input True when it returned '1' instead of 'Nope'

I feel this function should work.

def distance_from_zero(num):
    if type(num) == int or float:
        return abs(num)
        return "Nope"

print distance_from_zero(-25)


We need to carry out the same comparison for both operands of the OR expression.

if ... == int or ... == float


its also getting error msg


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.