Review: Built-In Functions


Traceback (most recent call last):
File "python/", line 152, in

I was stuck at this exercise and cannot proceed to the next.
However, I don't know what's wrong with my script.

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


Interesting...I passed this lesson a long time ago. I went back to it and ran my code. Error pops up for me too.

I did this to pass it again (though it only works one time):
I switched browsers from Chrome -> IE. Ran my code there and it passed. If I ran it the second time, I get the error.
Your code itself looks fine.


Nothing is wrong with the code, maybe just a ghost in the machine, so to speak. I was able to replicate the problem by doing a copy/paste of your code and get past it by erasing the code and re-typing it in by hand.


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