Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

DATA.TXT file Canada, CAD, 99, -3.5, North America, English, French USA, USD, 86, -5, North America, English Mexico, MXN, 93, -6, North America, Spanish France,

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

DATA.TXT file

Canada, CAD, 99, -3.5, North America, English, French USA, USD, 86, -5, North America, English Mexico, MXN, 93, -6, North America, Spanish France, EUR, 99, 1, Europe, French Germany, EUR, 99, 1, Europe, German Japan, JPY, 99, 9, Asia, Japanese China, CNY, 96, 8, Asia, Chinese Brazil, BRL, 92, -3, South America, Portuguese India, INR, 74, 5.5, Asia, Hindi, English Indonesia, IDR, 93, 7, Asia, Indonesian Pakistan, PKR, 72, 5, Asia, Urdu, English Bangladesh, BDT, 72, 6, Asia, Bengali Russia, RUB, 99, 3, Europe, Russian Nigeria, NGN, 69, 1, Africa, English Egypt, EGP, 73, 2, Africa, Arabic Iran, IRR, 84, 3.5, Asia, Persian Turkey, TRY, 96, 2, Europe, Turkish Venezuela, VEF, 93, -4.5, South America, Spanish

Help in python please

Concepts - Review of CS1110 concepts such as basic data structures, control flow structures, and functions in Python - Use flow chart to design a function Problem Specification - Your program is to calculate the country information based on an input file. - Each input file contains the meta-information in the following order. 1) Name of Continent 2) Currency 3) Literacy_rate 4) Time_zone 5)Continent 6)Main Language 7)Most spoken language - For example, the data.txt as input looks like: Canada, CAD, 99, -3.5, North America, English, French USA, USD, 86, -5, North America, English Mexico, MXN, 93, -6, North America, Spanish France, EUR, 99, 1, Europe, French Germany, EUR, 99, 1, Europe, German Japan, JPY, 99, 9, Asia, Japanese China, CNY, 96, 8, Asia, Chinese Brazil, BRL, 92, -3, South America, Portuguese India, INR, 74, 5.5, Asia, Hindi, English Indonesia, IDR, 93, 7, Asia, Indonesian Pakistan, PKR, 72, 5, Asia, Urdu, English Bangladesh, BDT, 72, 6, Asia, Bengali Russia, RUB, 99, 3, Europe, Russian Nigeria, NGN, 69, 1, Africa, English Egypt, EGP, 73, 2, Africa, Arabic Iran, IRR, 84, 3.5, Asia, Persian Turkey, TRY, 96, 2, Europe, Turkish Venezuela, VEF, 93, -4.5, South America, Portuguese - You take in the whole input file in .txt format and print the desired output in the console. - You need to parse each line for the given txt file and find out the total population, total area, languages spoken for each continent that must be sorted. The output should contain the metainformation in the following order: 1) Name of Continent: String 2) Currency : String 3) Literacy_rate : int 4) Time_zone : int 5)Continent: String 6)Main Language: String 7)Most spoken language: String - The output for data.txt is as follows: Name of Continent: Africa Currency: NGN Literacy Rate: 69 Time Zone: 1.0 Main Language: English Most Spoken Language: Countries: Nigeria Egypt Name of Continent: Asia Currency: JPY Literacy Rate: 99 Time Zone: 9.0 Main Language: Japanese Most Spoken Language: Countries: Japan China India Indonesia Pakistan Bangladesh Iran Name of Continent: Europe Currency: EUR Literacy Rate: 99 Time Zone: 1.0 Main Language: French Most Spoken Language: Countries: France Germany Russia Turkey Name of Continent: North America - We have provided one test file "data.txt". - You should create file "data_short.txt" by yourself. - To create test cases for the program, you can create a series of input file with known data and corresponding expected output. Then, you can write test functions that use these input file and expected output to verify that the parse_input_file function is correct. - Once the find the correct output for "data.txt", finish up your work by doing the same for "data_short.txt". Design Requirements Basic Structure Your code should be designed in a similar fashion to the following template. A more detailed template has been given to you in the assignment folder. Fucntions and their Description: - find_name: Find the name of the country from the list of strings. - find_currency: Find the currency of the country from the list of strings. - find_literacy_rate: Find the literacy rate of the country from the list of strings. - find_time_zone: Find the time zone of the country from the list of strings - find_continent: Find the continent of the country from the list of strings. - find_main_language: Find the main language of the country from the list of strings. - find_most_spoken_language: Find the most spoken language of the country from the list of strings. - parse_input_file: Open the input text file and parse input line by line and get details using the above mentioned functions. This Function outputs the sorted list as seen in the sample output - Main: Calls the pasrse_input_file with relevant document and prints the output. "n"Find the most spoken language of the country from the list of strings." " def parse_input_file(input_file): "" "Open the input text file and parse input line by line and get details using the above mentioned functions. This Function outputs the sorted list as seen in the sample output" Flowchart You must design a flowchart for each function to illustrate how function is designed. Also, you need to design a flowchart to show how the drive code is designed in terms of how inputs are received, and the functions are called. Implementation Phase Using the pseudocode developed, write the Python code for your assignment. This is a two-week assignment. Testing Phase - The data.txt is given to you with its output. The output should match exactly. - Build your program incrementally, carefully testing each function as you go. Grading - You can earn about 115 points in this assignment. The 15 points counts towards your extra credit. - A correct program with correct output, with proper use of all the function is worth 100 points. - If you chose to not use python's .split and build your own split function you will earn extra 10 points. - If you chose to find out the most spoken language in each continent, you will earn extra 5 points. Assignment Submission - Generate a .zip file that contains all your files including: - Program Files - Any input or output files - Flowchart - Pseudocode - data_short.txt

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database In Depth Relational Theory For Practitioners

Authors: C.J. Date

1st Edition

0596100124, 978-0596100124

More Books

Students also viewed these Databases questions

Question

Define a derivative instrument as per U.S. GAAP and as per IFRS.

Answered: 1 week ago