Question: Create a dictionary that maps countries to their capitals. 1. Create an empty dictionary. 2. Ask the user to input of the country and its
Create a dictionary that maps countries to their capitals. 1. Create an empty dictionary. 2. Ask the user to input of the country and its capital and add them to the dictionary. (Note: - use comma to separate the country and capital. - When user enters Q, Q to quit the entry loop ) For example: Enter a country and a capital comma separated (Q,Q to quit): US, Washington D.C. Enter a country and a capital comma separated (Q,Q to quit): UK, London Enter a country and a capital comma separated (Q,Q to quit): France, Paris Enter a country and a capital comma separated (Q,Q to quit): Japan, Tokyo Enter a country and a capital comma separated (Q,Q to quit): Germany, Berlin Enter a country and a capital comma separated (Q,Q to quit): Q,Q 3. Once the dictionary is created, print the dictionary and capitals in alphabetical order.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
