Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi I need some help with this program I am confused on what the description wants me to do can someone please help thankyou I

Hi I need some help with this program I am confused on what the description wants me to do can someone please help thankyou

I have added the passengers name but I cant seem to know how to print it to the list that what I am confused at. Please help!!!!

The example program below shows how the above methods might be used to store passenger names and travel destinations in a database. The use of strip(), lower(), and upper() standardize user-input for easy comparison:

Run the program below and add some passengers into the database. Add a duplicate passenger name, using different capitalization, and print the list again.

menu_prompt = ('Available commands: ' ' (add) Add passenger ' ' (del) Delete passenger ' ' (print) Print passenger list ' ' (exit) Exit the program ' 'Enter command: ')

destinations = ['PHX', 'AUS', 'LAS']

destination_prompt = ('Available destinations: ' '(PHX) Pheonix ' '(AUS) Austin ' '(LAS) Las Vegas ' 'Enter destination: ')

passengers = ['Sam','John','Nicole'] passengers_prompt = ('Available passengers: ' '(Sam) SAM ' '(John) JOHN ' '(Nicole) NICOLE ' 'Enter passengers: ')

print('Welcome to Mohawk Airlines! ') user_input = input(menu_prompt).strip().lower()

while user_input != 'exit': if user_input == 'add': name = input('Enter passenger name: ').strip().upper() destination = input(destination_prompt).strip().upper() if destination not in destinations: print('Unknown destination. ') else: passengers[name] = passengers elif user_input == 'del': name = input('Enter passenger name: ').strip().upper() if name in passengers: del passengers[name]

elif user_input == 'print': for passenger in passengers: print('%s --> %s' % (passenger.title(), passengers[passenger])) else: print('Unrecognized command.')

user_input = input('Enter command: ').strip().lower()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions