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.
Stefan Siljanovski6,063 Points
When asked how many tickets I input negative number (-5) and still sold me tickets ?
It still sold me tickets after answering negative number (-5) and gave me a total due of -48 and increased the number of tickets for variable tickets_remaining to 105 . How do we prevent that from happening ?
Steven Parker217,626 Points
The original code only checks if the requested number is more than the remaining tickets. But you can easily add another check for a number that is too small:
if num_tickets < 1: raise ValueError("We cannot sell less than 1 ticket!")