Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics All Together Now Handle Exceptions

Im 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))

    number_of_tickets = int(number_of_tickets)
except ValueError:
    print("You must enter a number")
    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":
        tickets_remaining = tickets_remaining - number_of_tickets
        print("Thanks {}".format(name))

print("Sorry, there are no more tickets availabe")

Never mind, I realised I missed a parenthesis at then died of line 5, it works now

1 Answer

Steven Parker
Steven Parker
215,268 Points

Spelling, 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.