IN PYTHON: Write a program to study countries and their capitals. The program will store country:capital information...

70.2K

Verified Solution

Question

Programming

IN PYTHON:

Write a program to study countries and their capitals. Theprogram will store country:capital information and allow the userto quiz themselves.

These two functions are required for this assignment.You may add other functions that you deem appropriate:

- menu()   This function,which displays all the user options to the screen, prompts the userfor their choice and returns their choice. This function willverify user input and ALWAYS return a valid choice.

- addCapital(dict) This functionaccepts a dictionary as a parameter. This dictionary contains storecountry:capital pairs.

THE PROGRAM MUST:

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

- The user can enter a country, and if that country is in thedictionary, it’s capital is printed, otherwise, an error message isprinted.

- 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

Answer & Explanation Solved by verified expert
3.7 Ratings (592 Votes)
    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students