Review: built in functions


Oops, try again. Your function seems to fail on input -10 when it returned 'nope' instead of '10'

^^ that is my error message and I dont know how to fix it

def distance_from_zero(a):
    if a == type(12) or a == type(12.1):
        return abs(a)
        return "nope"


We need to take the type of input and compare to fixed types, int and float.

type (a) ...


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