In CodeAcademy, learning functions, my solution was exactly the same as the solution you’re supposed to use yet it kept giving me an error pointing to an "e" on else.
def distance_from_zero(num): if type(num) == int or type(num) == float: return abs(num) else: return "Nope"
File "python", line 4 else: ^ SyntaxError: invalid syntax.
I’ve tried checking what the solution was (by CodeAcademy’s "view solution" feature) but there was absolutely nothing different about it. I also tried refreshing the page thinking it would do something. My goal isn’t to just get past because I can easily get past by "replace solution" because it automatically thinks it’s correct allowing me to get by. My goal is to see why I got the syntax error.
Source: Python Questions