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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Julieta Dalla Pozza](https://uploads.teamtreehouse.com/production/profile-photos/11655513/micro_Screen_Shot_2021-03-03_at_21.13.34.jpg)
Julieta Dalla Pozza
4,337 PointsIF invalid syntax
Hello i have this code, and i don't get what i am doing wrong. Keep rising an invalid syntax error
while tickets_remaining >= 1:
print("There are {} tickets remaining.".format(tickets_remaining))
name = input("Morning there, what is your name? ")
ask_tickets = input("How many tickets do yo need, {}? " .format(name))
#calculate the price (number of tickets multiplied by the price) and assign it to a variable
try:
ask_tickets = int(ask_tickets)
#raise a value error if the request is for more tickets than are available
if ask_tickets > tickets_remaining:
raise ValueError print("Sorry there are only {}" .format(tickets_remaining))
ERROR :
File "tickets.py", line 14
if ask_tickets > tickets_remaining:
^
SyntaxError: invalid syntax
➜
1 Answer
![Chris Freeman](https://uploads.teamtreehouse.com/production/profile-photos/1153532/micro_image.jpg)
Chris Freeman
Treehouse Moderator 68,425 PointsHey Julieta Dalla Pozza,
It’s not the if
. The try:
block is missing an associated except
block.
Post back if you need more help. Good luck!!!