CJCoding With Joseph
15free / daySign inCreate account

Grade Book Menu

Write a grade book that keeps student names and whole-number marks in two parallel lists that start empty. Show the menu 1) Add student, 2) Show table, 3) Quit and read the choice with the prompt Choice: , stripped. Add reads a name with the prompt Name: and re-asks, printing A name is required. each time, while it is blank; then it reads a mark with the prompt Mark: and re-asks, printing Mark must be a whole number from 0 to 100. each time, while the text is not all digits (.isdigit()) or converts to more than 100; then both are appended with .append() and Added <name> with <mark>. is printed. Show prints No students yet. when the lists are empty, otherwise a header with the words Name and Mark using the spec {name:<20} {text:>4}, one row per student with {name:<20} {mark:>4} (an index counter beside the for loop reaches the mark at the same position), and then Average: <value> with two decimals from sum() and len(). Quit prints Goodbye! and leaves the loop; anything else prints Unknown choice - try again.. Input: one line per choice, name or mark, ending with 3. Prompts are part of the output, so the prompts of one add and its confirmation run together on one line, and the header follows Choice: .

Expected Output:

1) Add student
2) Show table
3) Quit
Choice: Name: Mark: Added Maya with 88.
1) Add student
2) Show table
3) Quit
Choice: Name: Mark: Added Ali with 92.
1) Add student
2) Show table
3) Quit
Choice: Name                 Mark
Maya                   88
Ali                    92
Average: 90.00
1) Add student
2) Show table
3) Quit
Choice: Goodbye!

= newline. The output ends with a newline — print one after the last line.

Hints4 available
Topics:
Menus & Validation
📥 Auto-Input:
1\nMaya\n88\n1\nAli\n92\n2\n3\n
This input is automatically fed to your program's stdin
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.