Question: (level 2: Recognize Known Commands >>> Hello, my name is Monty >>> What can I do for you? list >>> Nothing to list >>> What
(level 2: Recognize Known Commands
>>> Hello, my name is Monty
>>> What can I do for you?
list
>>> Nothing to list
>>> What can I do for you?
foo
>>> OOPS! Unknown command
>>> What can I do for you?
exit
>>> Are you sure? y/n
n
>>> What can I do for you?
exit
>>> Are you sure? y/n
y
>>> Bye!)
Use Functions
Restructure the Monty Level 2 code to fit the following structure, while keeping the behavior same as before.
import sys # ADD MISSING FUNCTIONS def main(): print_greeting() while True: command = read_command() execute_command(command) main()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
