Question
PYTHON PROGRAM Not too sure how to go about writting this program please help!! The input file looks as follows: 1:Qatar:98900 2:Liechtenstein:89400 3:Luxembourg:80600 4:Bermuda:69900 5:Singapore:59700
PYTHON PROGRAM
Not too sure how to go about writting this program please help!!
The input file looks as follows:
1:Qatar:98900 2:Liechtenstein:89400 3:Luxembourg:80600 4:Bermuda:69900 5:Singapore:59700 6:Jersey:57000 ...
and so on all the way to #228.
This is what I need to learn to do:
For this exercise, you will write a program that makes use of two dictionaries. The program should read the data in rawdata.txt into a dictionary whose keys are country names and whose values are per capita incomes. Also create another dictionary whose keys are letters A Z and whose values are sets of country names. Convert the country names to all uppercase for both dictionaries. Your program should prompt the user to enter an initial or a country names and then print the corresponding values.
If the user enters a string with only one letter (like A), the program should print all the countries that begin with that letter, If the user enters a string that contains more than one letter, print the corresponding value for that country if it exists or print Does not exist if invalid. Stop when the user enters quit.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started