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)
![Nina Maxberry](https://secure.gravatar.com/avatar/f90ce7b3818e97887c89e8f8f6226717?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Nina Maxberry
10,630 PointsMasterticket.py - can't decrease ticket sells
Assignment is to decrease ticket sells until no tickets are available. I thought I followed the video but apparently I didn't. Sold and decreasing tickets do not print or work.
Here's my code, what is wrong?
TICKET_PRICE = 10
tickets_remaining = 100
while tickets_remaining >= 1:
print("There are {} tickets remaining.".format(tickets_remaining))
first_name = input("What is your first name? ")
tickets_requested = input("How many tickets would you like, {}? ".format(first_name))
tickets_requested = int(tickets_requested)
amount_due = tickets_requested * TICKET_PRICE
print("The total due is ${}".format(amount_due))
proceed = input("Would you like to purchase the tickets? Y/N ")
if proceed.lower() == "y":
# TODO: Gather credit card information and process it.
print("SOLD!")
tickets_remaining -= tickets_requested
else:
print("Thank you for your interest, {}!".format(first_name))
print("Sorry the tickets are all sold out!")
4 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 PointsIt sounds like your if proceed.lower() == "y": block isn't indented enough. Can you post a snapshot? It is the camera icon in the upper right corner of the workspace.
![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 PointsYou should format your code using markdown. See the cheatsheet at the bottom of the page. This is especially true for Python where indentation is very important.
Here is a snapshot of your code that appears to function correctly:
Do you see errors in the console when you run yours?
![Nina Maxberry](https://secure.gravatar.com/avatar/f90ce7b3818e97887c89e8f8f6226717?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Nina Maxberry
10,630 PointsKris, there are no errors showing in console except it continues to state I have 100 tickets available. It doesn't matter whether one person buys all 100 or I split it up amongst other purchasers. It doesn't print out ("SOLD"!) or anything it just keeps asking me what is my name and how many tickets I wish to purchase.
![Nina Maxberry](https://secure.gravatar.com/avatar/f90ce7b3818e97887c89e8f8f6226717?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Nina Maxberry
10,630 PointsKris, It was my indenting.
TICKET_PRICE = 10
tickets_remaining = 100
while tickets_remaining >= 1:
print("There are {} tickets remaining.".format(tickets_remaining))
first_name = input("What is your first name? ")
tickets_requested = input("How many tickets would you like, {}? ".format(first_name))
tickets_requested = int(tickets_requested)
amount_due = tickets_requested * TICKET_PRICE
print("The total due is ${}".format(amount_due))
proceed = input("Would you like to purchase the tickets? Y/N ")
if proceed.lower() == "y":
# TODO: Gather credit card information and process it.
print("SOLD!")
tickets_remaining -= tickets_requested
else:
print("Thank you for your interest, {}!".format(first_name))
print("Sorry the tickets are all sold out!")
The print line for the if proceed.lower command was not indented properly.
Thanks for you assistance.