Built in Functions


#1
Can any one tell me what's wrong here? It says that it returns nope for value -10

def distance_from_zero(n):
    if (n) == int:
        return abs(n) #integer
    elif n == float:
        return abs(n) #float
    else:
        return 'nope'

#2

You rather want to be checking the type of the value that is passed as the argument when calling(using) the function
like this

if type(argument) == specific_type: