Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Basics All Together Now Branch and Loop

Joaquim Maurício
Joaquim Maurício
1,148 Points

Problem with the IF statement syntax

Hello! First time posting here. The problem is in the following snippet: if option.lower() == "y": print("Thank you for your patronage!") tickets_remaining -= uammount

It is giving me the following syntaxerror: File "masterticket.py", line 22
if option.lower() == "y":
SyntaxError: invalid syntax

Any help is appreciated. Thanks!

2 Answers

Steven Parker
Steven Parker
229,582 Points

Often, when a syntax error is indicated at the very start of a line, the actual problem may be on the previous line.

I suspect that may be the case here, as there's nothing obviously wrong with the code shown. If you still don't spot it with this hint, please include the complete code, or at least more of the context near where the error occurred.

Joaquim Maurício
Joaquim Maurício
1,148 Points

Wow thanks for the lightning fast answer! I was missing a parenthesis in the line just before that one ahah

Glad to know I can count on the community :)