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

Python

code not running

My code won't run saying that there is an invalid syntax so now i'm stuck..please help TICKET_PRICE = 10

tickets_remaining = 100

print("There are {} tickets remaining".format(tickets_remaining))

first_name = input("What is your first name? ")

num_tickets = input("Hie {}, how many tickets would you like? ".format(first_name)) num_tickets = int(num_tickets)

amount_required = num_tickets * TICKET_PRICE

print("Required Amount is ${}".format(amount_required))

proceeding = input("Do you wish to proceed? Y/N ") if proceed.lower() == "y": print("SOLD!")

tickets_remaining -= num_tickets

else: print("Thanks for visiting {}".format(first_name))

1 Answer

You have an indentation problem in line 8

proceeding = input("Do you wish to proceed? Y/N ") if proceed.lower() == "y": print("SOLD!")

It should be:

proceeding = input("Do you wish to proceed? Y/N ") if proceed.lower() == "y":
    print("SOLD!")