← Back to Menus & Validation
Question 450
Letters In Any Case
Letters In Any Case
A letter menu: A) Add one adds one to a counter and prints Count: <n>, Q) Quit prints Goodbye! and leaves the loop, anything else prints Unknown choice - try again.. The dispatch is written; fix the line that reads the choice so that spaces around the letter and lower-case letters are accepted too, using .strip() and .upper() on what input() returns. Input: one choice per line, the last one q or Q. The prompt Choice: is part of the output, so each message follows it on the same line.
Expected Output:
A) Add one Q) Quit Choice: Count: 1 A) Add one Q) Quit Choice: Goodbye!
= newline. The output ends with a newline — print one after the last line.
Hints2 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.