Review Built in functions


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

^whats wrong with this code?It says--

File "python", line 2
if type(a)==int or type(a)==float:
IndentationError: expected an indented block

Please help me out.I faced this indentation error alot in earlier lessons as well.Thankyou :slight_smile:


Can you post a screen shot of your code because the forum has an issue with printing code with correct indentation. However you might running that if statement outside of the function or too far in it.

P.S. remove the quotes("") from the return statement of the absolute value.


HI like the error says
IndentationError: expected an indented block
you should indent the if and else statement inside the function


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