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!
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
How would you get it so sold out message doesn't appear for the user who buys last ticket?
How would you get the sold out to not show for person purchasing X amount of tickets while X amount are available.
Trying to figure out how to get it to once its sold out, it still prompts for name but replies with, Sorry (NAME) the event is sold out.
(hopyfully im not jumping ahead and its fixed in next)
Steven Parker227,114 Points
Since this simple program always begins with a constant number of tickets, you could simply remove the "sold out" message "print" statement completely to prevent the last person from seeing it. You could also change the message to say something like "Thanks for purchasing the last ticket" instead, since you know it will only be shown after the last ticket is purchased.
Shiming Zhang829 Points
Why the tickets_remaining still large than 1, it prints "Sorry the tickets are all sold out."