Review: Built in functions


#1
def distance_from_zero(n):
	if type(n) == int or type(n) == float:
    return abs(n)
 	else:
    return "Nope"
  • not quite sure what i’m doing wrong. I’ve got the correct indentation (although it doesn’t show here) but i’m still getting an error. It’s basically identical to the correct code given, but I still receive an error. Any ideas? Or is this just another bug?

#2

i added the format, next time you can do it yourself:

How do I format code in my posts?

so indent shows up, looking at your code:

Screenshot_2018-02-02_17-20-52

the indent looks off.


#3

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