+1 (315) 557-6473 

Top-ranking Print Menu Homework Help Using Python

Programming Homework Help is the first name you should remember when you need print menu homework help. Our Python homework tutors are at your service whenever you need them. They will do everything humanly possible to customize your homework as per your instructions and deliver impeccable solutions before your due date. Our print menu homework help service also has a myriad of freebies including unlimited free reworks, expert written solutions and many more.

Creating a Print Menu Using Python

In PyCharm, create a new project or open an existing one (such as Labs). If you create a new project use the same naming convention as the filename below.
Create a new Python file using the following naming convention:

Code Requirements

Your program must perform the following:
• Write a program that uses a while loop to respond to user input.
• Display a menu:
• What would you like to know?
• a) Favorite Animal
• c) Favorite Color
• m) Favorite Meal
q) Quit
• Get input from the user using ">" as a prompt. Allow the user to enter in lowercase or uppercase letters for the menu options.
• For each option of the menu, respond to the user by printing a message. You need to use branching. You can put information about yourself or make it up. Feel free to add more menu options.
• Handle an invalid input with a message such as "That option is not available".

Sample Program Output

What would you like to know?
a) Favorite Animal
c) Favorite Color
m) Favorite Meal
q) Quit
>a
My favorite animal is a cat.
What would you like to know?
a) Favorite Animal
c) Favorite Color
m) Favorite Meal
q) Quit
>b
That option is not available.
What would you like to know?
a) Favorite Animal
c) Favorite Color
m) Favorite Meal
q) Quit
>C
My favorite color is blue.
What would you like to know?
a) Favorite Animal
c) Favorite Color
m) Favorite Meal
q) Quit >Q Goodbye
Code Solution
defmainMenu():
print('What would you like to know?')
print('a) Favorite Animal')
print('c) Favorite Color)')
print('m) Favorite Meal')
print()
print('q) Quit')
return input('>')
while True:
choice = mainMenu().lower()
if choice == 'a':
print('My favorite animal is a cat.')
elif choice == 'c':
print('My favorite color is blue.')
elif choice == 'm':
print('My favorite meal is pizza.')
elif choice == 'q':
print('Goodbye')
break
else:
print('That option is not available')
print()

Related Blogs