Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Python Create a dictionary of Cities that begin with any 5 letters of the alphabet Each letter should have a minimum of 3 Cities

In Python

Create a dictionary of Cities that begin with any 5 letters of the alphabet

Each letter should have a minimum of 3 Cities

E.G. C => Cairo , Casablanca, Chennai

D => Dakar, Delhi, Dallas

Create a program that displays a menu which gives the user the opportunity to view, add, or delete a City from a dictionary of Cities. It will also allow the user to shuffle the order of both the City letters and City names order of each letter.

Lastly, the menu should also, give the user the opportunity to exit the program.

Create a function for this named 'display_menu'.

It will explain to the user the list of possible actions (outlined below)

Create a function named 'view'.

It will evaluate the argument passed to it. If it is one character and exists in the dictionary of cities, it will display all the cities starting with that letter. If not, it will display all the cities

Create a function named 'add'.

It will take one argument and ensure the argument is at least 4 characters.

It will then put the city into its appropriate place.

It will return a boolean value of whether or not the addition was successful

Create a function named 'delete'.

It will take one argument and search for the city. If it is found, it will remove it.

It will return a boolean value of whether or not the deletion was successful

Create a function named 'shuffle'.

It will re-order both the city letters order and the city names order

Create a function named 'start'.

It will call the display_menu method in an indeterministic loop that will stop once the user types either 'stop' or 'quit'

Create a function named 'main'.

It will determine if the current module is the main module, if it is, it will call the start method

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

Successful Keyword Searching Initiating Research On Popular Topics Using Electronic Databases

Authors: Randall MacDonald, Susan MacDonald

1st Edition

0313306761, 978-0313306761

More Books

Students also viewed these Databases questions

Question

1. Diagnose and solve a transfer of training problem.

Answered: 1 week ago