Question: Needs to be done in Python. Here is a sample of the text. Below the sample is my code. I have done #1 but need

Needs to be done in Python. Here is a sample of the text. Below the sample is my code. I have done #1 but need help with #2, and #3 function
1:South Sudan:3.92 2:Malawi:3.32 3:Burundi:3.26 4:Niger:3.22 5:Uganda:3.22 6:Burkina Faso:3.01 7:Mali:2.96 8:Zambia:2.94 9:Ethiopia:2.88 10:Iraq:2.87 11:Tanzania:2.77 12:Western Sahara:2.76 13:Benin:2.75 14:Angola:2.72 15:Togo:2.66 16:Qatar:2.64 17:Guinea:2.62 18:Cameroon:2.58 19:Madagascar:2.54 20:Rwanda:2.53 21:Egypt:2.51 22:Equatorial Guinea:2.48 23:United Arab Emirates:2.47 24:Mozambique:2.45
DEFAULT_FILE = "lab6input.txt" def main(): userInputFunc() countryDict = readData() with open(DEFAULT_FILE) as infile: lines = [] countryDict = {} aline = infile.readline() while aline != "": aline = aline.rstrip() aline = aline.split(":") lines.append(aline) aline = infile.readline() for i in range (len(lines)): lines[i].pop(0) countryDict[lines[i][0]] = lines[i][1] return countryDict
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
