Ask coding questions

← Back to all posts
3
SOLVED: Why does this say it's invalid syntax?
JAGMAN248 (4)

I'm not sure why this is giving me this error. It appears that it should work but doesn't. Here's the link https://repl.it/@JAGMAN248/Roll-the-Dice. Thanks for your help!

Commentshotnewtop
2
21natzil (687)

On line 66, you forgot to end it with a second ). Tip: If you can't find the issue with the current line in syntax errors, look at the couple of lines before it.

1
1
theangryepicbanana (663)

you need an else statement for the previous if/elif chain. I'd also recommend doing gold += bet * 2 instead of gold = gold + bet * 2

1
ArchieMaclean (524)

@theangryepicbanana that wasn't the reason for the syntax error though

1
ArchieMaclean (524)

Also later on you have some lines like
dialog("You won 5x your bet!") :
which is wrong (shouldn't have colon)

1
JAGMAN248 (4)

Ah, thanks so much!

1
ArchieMaclean (524)

on the line before you need to close the parentheses

1
ArchieMaclean (524)

@ArchieMaclean dialog("The roll was " + str(roll))
you missed the final closing parenthesis