Review: Built-In Functions - What is the problem?


Review: Built-In Functions

This is my code:

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

And this is the error message I receive

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

What am I doing wrong? Thank you.


This should be a return statement so the value is sent back to the caller.


Hi mtf.

Thanks for your suggestion.Even tohugh I tried several ways based on that
but it didn't worked.

Could you please write the exact line or code?


Julio G.


I tried again, and now it's working.



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