Syntax error where there is none.
It says on line 38 at the last bracket that it is an invalid syntax where it isn't unless I am forgetting something because in my game it's supposed to be like bit life where it kills you at a random age so if someone could help I would be indebted.
The problem in line 38 is that you haven't put a colon after the condition in your while loop. And after the colon, you should also indent all the code you want to be inside the loop.
However, there are actually quite a few other things wrong with the code.
- First off, you don't write
int(5), you just write
int(5)means you're passing
5(which is already an
intwhich gives you back the same 5 you put in. As you can see, that doesn't make much sense.
- At line 195, you say
from goto import *, which is unnecessary because you already did that at the beginning of the script.
- At lines 194, 215, and 391, the
ifstatements aren't indented right.
- The range function takes either 1, 2, or 3 arguments.
- If there is one argument, then that is the last number and 0 is the first.
- If there are 2, then the first argument is the first number and the second argument is the last number.
- With 3 arguments, it works just like 2, except that the last number is the difference between any two consecutive numbers (by default that is 1). For example,
range(1, 10, 2)gives you
[1, 3, 5, 7, 9]
- So you can't say
range(0, 1, 2, 3)like you do at line 35. You might be looking for
[0, 1, 2, 3], which is the same as
- Similarly, you also can't say
random.randint(0,1,2,3)at line 36, because
randinttakes in 2 arguments, the first being the minimum value of the random number and the second being the maximum value of the random number. If you're trying to get a number between 0 and 3, you should do
These are just the ones I spotted right away, There are actually quite a bit more.
If you did make this game, I'd recommend testing out things more often. Otherwise, you'll end up with bugs like these that are much harder to fix later on.