Feb-07-2021, 09:43 PM
(This post was last modified: Feb-07-2021, 09:44 PM by nickster11.)
Hello I am currently having issues with my homework assignment, here are the instructions.
Create a list at the top of the program with three names, all using title capitalization.
Using a while loop, display the menu shown above and ask the user to make a selection using the input() command.
If the user selects 0, then change the while loop condition so that the loop will exit.
If the user selects 1, sort the list and display each name on a separate line. Be sure to use the methods shown in Chapter 5 for sorting and displaying elements of the list.
Here is what I have, I am stumped and really do not know where to go from here.
Create a list at the top of the program with three names, all using title capitalization.
Using a while loop, display the menu shown above and ask the user to make a selection using the input() command.
If the user selects 0, then change the while loop condition so that the loop will exit.
If the user selects 1, sort the list and display each name on a separate line. Be sure to use the methods shown in Chapter 5 for sorting and displaying elements of the list.
Here is what I have, I am stumped and really do not know where to go from here.
menu = """ 0: Exit 1: Display a sorted list of guests. 2: Add a guest to the list. 3. Delete a guest from the list. """ guestlist = ['Nick', 'Robert', 'Deondre'] while True: choice = input(menu).strip() if choice == '0': print('\nThank you for using guest list manager.') elif choice == '1': guestlist.sort() print('\n Guests so far:', ', '.join(['{:.2f}'.format(guestlist) for guestlist in guestlist])) elif choice == '2': new_guest = float(input('\nPlease enter a new guest.: ')) if new_guest == 0: print('That name is already on the list') elif new_guest == 0: else: guestlist.append(new_guestlist) elif choice == '3': guestlist.sort()