← Back to Menus & Validation
Question 458
Name List Menu
Name List Menu
A list of names starts empty. 1) Show names prints No names yet. when the list is empty, otherwise one line per name in the form <number>. <name> numbered from 1 with a counter; 2) Add name reads a name with the prompt Name: , appends it with .append() and prints Added <name>.; 3) Quit prints Goodbye! and leaves the loop; anything else prints Unknown choice - try again.. Input: one line per choice or name, ending with 3. Prompts are part of the output.
Expected Output:
1) Show names 2) Add name 3) Quit Choice: Name: Added Maya. 1) Show names 2) Add name 3) Quit Choice: Name: Added Ali. 1) Show names 2) Add name 3) Quit Choice: 1. Maya 2. Ali 1) Show names 2) Add name 3) Quit Choice: Goodbye!
= 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.