Bug? My code is right 99% sure


#1



Review: Built-In-Functions (19)

**First, def a function called distance_from_zero, with one argument (choose any argument name you like).
If the type of the argument is either int or float, the function should return the absolute value of the function input.
Otherwise, the function should return "Nope"**

My Error: Oops, try again. Your function seems to fail on input True when it returned '1' instead of 'Nope'


def distance_from_zero_(thing):
    if type(thing) == int or type(thing) == float:
        return abs(thing)
    else:   
        return "Nope"


#2

Refresh page and you'll probably get another error message. Your code doesn't define the function that's asked for, you've probably done so before though and that's what it's calling when testing - that previously defined function will not persist through refreshing the page.


#3

i refreshed and it worked lol ok thanks!


#4

I heard they are fixing the code glitch soon so no more glitches...


#5

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