19. built in functions



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

File "python", line 5
IndentationError: unindent does not match any outer indentation level

nothing just some help?

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

I am very aware that a few moderators have been trying to help people. i have trolled through most of them from 20 days ago. i dont understand there explanations or i wouldn't ask for help.


Your else statement is indented too far. Delete the spaces in front of it until it is in line with the if above it.


This should be indented by the same degree as the if header, in order for both block headers to match each other ...



thank you all. didnt know white space mattered that much..... armature hour!!! cheers


In Python, indentation must be exact, in order for the program to run properly. Unlike languages such as Java, JavaScript, and Ruby, that use things like braces to define the opening and closing of a piece of code with a body, we put a colon, and everything indented once from there is a part of it. This colon is called a delimiter.

For more information, you can go here:


Enjoy! :snake:


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