The Menu That Asks Again

Python for AIHard+10 XP+10

The Menu That Asks Again

A café kiosk asks customers to pick a menu option by number, from 1 to option_count. It keeps asking until it gets a good answer.

The replies come in as a list. Write menu_session(replies, option_count) that returns the list of messages the kiosk shows, in order. For each reply:

ReplyMessage
int() can't read it"Please type a number."
a number outside 1 to option_count"Choose 1 to N.", with N replaced by option_count
a good choice k"You chose k.", and the kiosk stops asking

If the replies run out before a good choice, add "No choice made." at the end.

Examples

replies = ["two", "9", "2", "3"]
option_count = 4
returns ['Please type a number.', 'Choose 1 to 4.', 'You chose 2.']
replies = ["1"]
option_count = 3
returns ['You chose 1.']

Hints

Solve it to unlock the solution

Once your code passes every test, a reference solution shows up here so you can compare it with yours.

solution.py
CtrlEnterto run