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)
![Alan Mariani](https://uploads.teamtreehouse.com/production/profile-photos/6174722/micro_Alan.jpg)
Alan Mariani
Courses Plus Student 1,499 PointsSyntaxError: invalid syntax
Hi, I reviewed my code, debugging some parts and it keeps throwing SyntaxError. Follows my code below. Can someone help me?
TICKET_PRICE = 10
tickets_remaining = 100
Output how many tickets are remaining using tickets_remaining variable
print("There are {} tickets remaining.".format(tickets_remaining))
Gather a user's name and assign it to a new variable
name = input("What's your name: ")
Prompt the user by name and ask how many tickets he/she would like
num_tickets = input("How many tickets would you like {} ?".format(name)) num_tickets = int(num_tickets)
Calculate the price (number of ticket multiplied by the price) and assign it to a variable
price = num_tickets * TICKET_PRICE
Output the price to the screen
print("The price is ${}".format(price))
Prompt user if they want to proceed ... Y/N
confirm_purchase = input("Would you like to proceed with the purchase? (Y/N) ")
If they want to proceed
If confirm_purchase.lower() == "y": #here SyntaxError occurs
# Print out to the screen "SOLD" to confirm purchase
print("SOLD!!")
# And then, decrement the number of tickets remaining by the number of tickets purchased
tickets_remaining -= num_tickets
Otherwise
else: # Thank them by name print("Thank you {}".format(name)
Thanks in advance!!!
3 Answers
![KRIS NIKOLAISEN](https://secure.gravatar.com/avatar/65d74a723997b41a80d2d909c6e06960?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
KRIS NIKOLAISEN
54,969 Pointsif should have a lowercase i here:
if confirm_purchase.lower() == "y":
You are also missing a closing parenthesis here:
print("Thank you {}".format(name))
![Alan Mariani](https://uploads.teamtreehouse.com/production/profile-photos/6174722/micro_Alan.jpg)
Alan Mariani
Courses Plus Student 1,499 PointsThank you so much Kris. Most of the replies which I verified in the forum was mentioning that the error was because a lack of parenthesis in the previous sentence. I didn't realized it could be after in somewhere below in the code. Thank you so much again!!!
![Marcos Duran](https://uploads.teamtreehouse.com/production/profile-photos/10424562/micro_Ricky_%2B_Marcos__BB__-_0476_-_CU1A9126.jpg)
Marcos Duran
Python Development Techdegree Student 3,052 PointsThank you as well!! Same issue!