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)
![Jan Habermann](https://secure.gravatar.com/avatar/d0524f3b331be0f5fe8f6ee022694a4c?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Jan Habermann
463 PointsSyntaxError: Invalid Syntax
This is my code
TICKET_PRICE = 10
tickets_remaining = 100
while tickets_remaining >= 1:
name = input("What is your name? ")
print("Welcome {}!".format(name))
print("There are {} tickets remaining.".format(tickets_remaining))
try:
order_amount = int(input("How many of those would you like," + name + "? "))
if order_amount > tickets_remaining:
raise ValueError ("Sorry there are only {} tickets left".format(tickets_remaining)
except ValueError as err:
print("Sorry, we ran into an issure. Please try again. {}.".format(err))
else:
order_price = order_amount*TICKET_PRICE
print ("That comes up to $", order_price)
ask_proceed = input("Do you want to proceed? Y/N ")
if ask_proceed.lower() == "y":
print("SOLD!!! Have fun " + name)
tickets_remaining -= order_amount
else:
print("Thank you anyways {} and have a nice day".format(name))
print("Sorry that's all folks!! ")
I get a Syntax Error pointing to the e in except and I have no idea what is wrong, try and except ar indetned the same amount so that can't be it
2 Answers
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsWhen something needed is left off, the error often points to the next character after the problem.
In this case, the parentheses on the previous line are unbalanced (the function still needs a closing parenthesis).
![Jan Habermann](https://secure.gravatar.com/avatar/d0524f3b331be0f5fe8f6ee022694a4c?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Jan Habermann
463 PointsTrue, I missed that, seems like I thought I neededd to allignt it with the "if" for some reason
thanks a lot
Jan Habermann
463 PointsJan Habermann
463 PointsThanks a lot, didn't know that sometimes the next character get pointet to.
Now I get a syntax error on the else for wome reason though
Steven Parker
230,688 PointsSteven Parker
230,688 PointsThe "else" is indented too far and doesn't line up with the "try" and "except".