← Back to Menus & Validation
Question 452
Choice In Range
Choice In Range
Read a menu choice with the prompt Choice (1-3): and keep re-asking, printing Pick 1, 2 or 3. each time, until the stripped text is exactly 1, 2 or 3; then print You picked <choice>.. Compare the text itself, no conversion needed. Input: one answer per line; the last line is valid. The prompt is part of the output, so each message follows a prompt on the same line.
Expected Output:
Choice (1-3): Pick 1, 2 or 3. Choice (1-3): Pick 1, 2 or 3. Choice (1-3): You picked 3.
= 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.