Stefan Siljanovski5,489 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 Parker194,826 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!")