← Back to Menus & Validation
Question 442
Digits Only Please
Digits Only Please
Ask How many tickets? (with a space after the question mark) and keep asking, printing Digits only. each time, until the stripped answer is made of digits only, checked with .isdigit(). Then convert it with int() and print Booked <n> tickets.. Input: one answer per line; the last line is always digits. Each prompt is part of the output, so the message printed after a bad answer, and the final sentence, follow a prompt on the same line.
Expected Output:
How many tickets? Digits only. How many tickets? Booked 2 tickets.
= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
Menus & Validation
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.