Review: Built-In Functions



I’m a bit curious on the function lesson 19/19 on the “Review: Built-In Functions”
I create exactly as the solution build, but it doesn’t work. it says
File “python”, line 11
return abs(s)
IndentationError: expected an indented block

This is the code

#this one is the solution
def distance_from_zero(num):
if type(num) == int or type(num) == float:
return abs(num)
return “Nope”

#this one I create myself
def distance_from_zero(s):
if type(s) == int or type(s) == float:
return abs(s)
return “Nope”

can someone tell me what did I do wrong?


probably mixing tabs with spaces (which doesn’t show in your screenshot and the text you posted is missing indentation altogether - code needs to be copied exactly or you’re sharing something else)


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