"Sorry Tickets are all sold out!" continues to loop when trying to request more than 100 tickets
OK so the title says what I'm seeing when executing the code, which is as follows:
Here is what I see when testing it out:
There are 100 tickets remaining
What is your name? Chris
How many tickets would you like, Chris? 120
On no. We ran into an issue. There are only 100 tickets remaining. Please try again.
Sorry the tickets are all sold out. :(
There are 100 tickets remaining. What is your name?
OK so why is this looping the way it is?
Steven Parker170,474 Points
If you want the program to stop, you can use a "
break" statement after you've responded to the input (such as between lines 16 and 17). And if you want to start over, you could use a "
continue" statement at the same place instead.
But if you don't do either, the code will continue at line 27 and print the "sold out" message before repeating.