Module 19/19 - Syntax Error


n = raw_input("Number: ")

def distance_from_zero (n):
if type(n) == int or type(n) == float:
return abs(n)
return ‘nope’

this is my code I have and when I run it the error message says I have a syntax error by “else” and I dont know what is wrong… please help lol


You can figure that out yourself if you start with something very simple you know to be correct and slowly add parts back to it

And, take some care that others can get an exact copy of your code, otherwise the purpose of showing the code is defeated (do you due diligence before asking)


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