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 trialMike Moore
529 PointsIm getting a SyntaxError on line 6. Any suggestions?
TICKET_PRICE = 10 tickets_remaining = 100
while tickets_remaining != 0:
print("There are {} tickets remaining".format(tickets_remaining)
name = input("Enter your name? ")
number_of_tickets = input("{} How many tickets would you like?".format(name))
try:
number_of_tickets = int(number_of_tickets)
except ValueError:
print("You must enter a number")
else:
total_price = number_of_tickets * TICKET_PRICE
print("{} the total cost of your tickets will be £{}".format(name,total_price))
proceed = input("{} would you like to proceed please answer Y/N".format(name))
if proceed == "Y":
print("Sold!")
tickets_remaining = tickets_remaining - number_of_tickets
else:
print("Thanks {}".format(name))
print("Sorry, there are no more tickets availabe")
1 Answer
Steven Parker
231,172 PointsSpelling, indentation, and balanced parentheses are always good "first glance" checks for errors.
And when posting code to the forum, use Markdown formatting to preserve the appearance, or share the entire workspace by making a snapshot and posting the link to it.
Mike Moore
529 PointsMike Moore
529 PointsNever mind, I realised I missed a parenthesis at then died of line 5, it works now