Question: Create a Python script that will read all data from the file and store it in memory. Display a message to the user indicating the

Create a Python script that will read all data from the file and store it in memory. Display a message to the
user indicating the data has been loaded and is ready for querying. Include the number of countries available
for querying in your message. Then, allow the user to enter a country name, or the first letter of a country
name. When the user enters a country name, such as United Kingdom, the script will provide the export
amount in billions to the nearest two decimal places (i.e., $741.95B) as part of a well-formatted report
(output). When the user enters only a single letter for the country name, such as Z, the script will provide an
export amount, in billions to the nearest two decimal places, as part of a well-formatted report (output) for all
countries starting with that letter (i.e., Zambia and Zimbabwe). When the user enters an invalid country name
or a single letter that does not match any country names, the user should be informed there are no matches.
The user will then continue to be asked for additional country names or first letters of country names, until
they have indicated they have finished. Once the user has indicated they have finished, prompt the user to
determine whether they would like to have a formatted file of all countries. When the user does not provide
an adequate answer to this question, they must be continuously re-prompted until they provide an adequate
answer. Otherwise, if the user indicates they want the formatted file, generate a text file containing each
country name and export amount formatted in billions, to the nearest two decimal places

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!