Last answered:

11 Apr 2020

Posted on:

11 Apr 2020


Built-in Functions exercises not working

def distance_from_zero(x):
    if type(x) == int or type(x) == float:
        return abs(x)
        print("Not Possible")
------------------------------------------------------ distane_from_zero(-10) ---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-20-81d9cd3c2284> in <module>
----> 1 distane_from_zero(-10)

NameError: name 'distane_from_zero' is not defined


Similar error is what I have been facing in the earlier question I asked in working with this very chapter based exercise ipynb files

1 answers ( 0 marked as helpful)
Posted on:

11 Apr 2020

Hi Satish! Thanks for reaching out! This means that you may have written, but you have not executed the code that defines the function called "distance_from_zero()". Please make sure to execute this code first, and then proceed with the rest of the code. Hope this helps.

Submit an answer