Ask coding questions

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

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!

Voters
nate8
MRrealSIR
JamesPorter3
LamidiZainab
BalaGopal1
TiaraJackson
BoxedFoxStudios
dkelly9912
pjuengst
Koaaalllaa
Comments
hotnewtop
JAGMAN248

Yeah it works now.

ArchieMaclean
21natzil

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.

TrestynStalling

i need help on this i cant get all me indents righthttps://repl.it/@TrestynStalling/Debugger-if-Else-1

ArchieMaclean

Does it work now?

theangryepicbanana

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

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

ArchieMaclean

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

JAGMAN248

Ah, thanks so much!

ArchieMaclean

on the line before you need to close the parentheses

ArchieMaclean

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