Ask coding questions

← Back to all posts
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
21natzil (749)

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.

theangryepicbanana (857)

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

ArchieMaclean (619)

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

ArchieMaclean (619)

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

JAGMAN248 (4)

Ah, thanks so much!

ArchieMaclean (619)

on the line before you need to close the parentheses

ArchieMaclean (619)

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