(Solved) : Must Python Sister Currently Preparing Contestant Jeopardy Must Master Countries Capitals Q42565010 . . .

Must be in Python

Your sister is currently preparing to be a contestant onJeopardy!, and she must master countries and their capitals. Youare going to code a study aid to help out. Your program will storecountry:capital information allow the user to quiz themselves in apaced manner.

**********************************************************************

The two functions described below are required for thisassignment. You may add other functions that you deemappropriate:

menu()   This function, whichdisplays all the user options to the screen, prompt the user fortheir choice and returns their choice. This function will verifyuser input and ALWAYS return a valid choice.

addCapital(dict) This function accepts adictionary as a parameter. This dictionary contains storecountry:capital pairs. The function prompts the user for a country.If the country is not already a key in this dictionary, the user isprompted for a capital and the pair is added to the dictionary. Ifthe country already exists in the dictionary, the user is informedthat the capital is already stored and no change is made to thedictionary.

THESE functions are to be stored in a MODULE, that is accessedby the main process file.

THE MAIN PROCESS:

Your program will have a dictionary for storing country:capitalpairs. This dictionary will initially be empty.

Your main will allow the user to do any of the following, untilthe user wishes to exit:

  • Add a country and it’s capital to the dictionary. TheaddCapital function is to be called to complete this task.

Both country and capital should be converted to first lettercapitalized only form. That is, if the country is entered asenGLand, it is stored as England. The string function title ishelpful here.

  • The user can enter a country, and if that country is in thedictionary, it’s capital is printed, otherwise an error message isprinted. Keep in mind that the data is stored as first letter caponly, so any user country must be converted to this form before theprogram looks to see if it is in the dictionary.
  • Print out the number of countries currently represented in thedictionary.
  • Print out all the countries which are currently represented inthe dictionary.
  • Print out all of the countries and their capitals currentlystored. If there are no capitals currently stored in thedictionary, a message is printed
  • Exit the program

Expert Answer


Answer to Must be in Python Your sister is currently preparing to be a contestant on Jeopardy!, and she must master countries and …

Leave a Comment

About

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us

× How can I help you?