What am I doing wrong?


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


you have to have a comparison in both cases, many people seem to cut this corner:

if type(l) == int or type(l) == float:

See? in both cases you have to compare. There is a programmers joke about this: Mother to son: Son, go to the market. Bring one bottle of milk, if they have eggs, bring 6. Son came home with 6 bottles of milk, the mother was surprised. Well, they had eggs so i bought 6. The joke relies on this principal, you didn't double check the condition. I know, terrible joke, too tempting


thx alot it helped me