Can somebody tell me what's wrong wrong with my code? I don't understand
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Tue Nov 22 00:19:54 EST 2016
On Tuesday 22 November 2016 14:10, rmjbros3 at gmail.com wrote:
> Hi! This is my first post! I'm having trouble understanding my code. I get
> "SyntaxError:invalid syntax" on line 49.
Sometimes a syntax error can only be reported on the line *following* the line
with the actual error. So you may have something like this:
x = func(y # oops forgot to close the brackets
for i in range(x): # error is reported here
...
So when you get a syntax error on a line, and cannot see anything wrong with
that line, work your way backwards until you find the actually location of the
error.
[...]
> elif raceNum==3:
> print("Nice fur. I don't see too many of your kind 'round here. Maybe
> that's a good thing...")
> print('')
> classNum=int(input("What's your profession mate?")
>
> elif raceNum==4: #this line has an error for some reason
This is the line where the error is reported. The error is actually on the
previous line. Do you see it now?
--
Steven
299792.458 km/s — not just a good idea, it’s the law!
More information about the Python-list
mailing list