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.
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 Parker210,423 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."