Deleted


#1

Here is my code:

def distance_from_zero(dfz):
if type(dfz) == int or float:
return abs(dfz)
else:
return 'Nope'

And it comes up with the error:
Oops, try again.
Your function seems to fail on input True when it returned '1' instead of 'Nope'

I am highly unsure what is causing this error and would be gratful for a responce. An answer to this piece would be useful also.


#2

def distance_from_zero(dfz):
    if type(dfz) == int or type(dfz) ==  float:
        return abs(dfz)
    else:
        return 'Nope'

You must reinterate that you want to check if type(dfz) is a float, otherwise it is just checking if float, which makes no sense.


#3

Cheers, helped alot.