Write a loop that prints each country's population in country_pop. Sample output with input: 'China:1365830000,India:1247220000,United States:318463000,Indonesia:252164800': United States has...


Python programming question.


How do I eliminate the error? I can't adjust the spacing for the print statement at all. It is a preprogrammed portion all I had to do was define the country and pop statements.


Write a loop that prints each country's population in country_pop.<br>Sample output with input:<br>'China:1365830000,India:1247220000,United States:318463000,Indonesia:252164800':<br>United States has 318463000 people.<br>India has 1247220000 people.<br>Indonesia has 252164800 people.<br>China has 1365830000 people.<br>1 user_input = input()<br>2 entries = user_input.split(',')<br>3 country_pop = {}<br>4<br>5 for pair in entries:<br>split_pair = pair.split(':')<br>country_pop[split_pair[0]] = split_pair[1]<br># country_pop is a dictionary, Ex: { 'Germany': '82790000', 'France': '67190000' }<br>6<br>8<br>9<br>Your solution goes here<br>country = split_pair[0]<br>pop= country_pop[country]<br>...<br>10<br>11<br>12<br>13<br>14<br>print (country, 'has', pop, 'people.')<br>

Extracted text: Write a loop that prints each country's population in country_pop. Sample output with input: 'China:1365830000,India:1247220000,United States:318463000,Indonesia:252164800': United States has 318463000 people. India has 1247220000 people. Indonesia has 252164800 people. China has 1365830000 people. 1 user_input = input() 2 entries = user_input.split(',') 3 country_pop = {} 4 5 for pair in entries: split_pair = pair.split(':') country_pop[split_pair[0]] = split_pair[1] # country_pop is a dictionary, Ex: { 'Germany': '82790000', 'France': '67190000' } 6 8 9 Your solution goes here country = split_pair[0] pop= country_pop[country] ... 10 11 12 13 14 print (country, 'has', pop, 'people.')
X Test aborted<br>Exited with return code 1.<br>File

Extracted text: X Test aborted Exited with return code 1. File "main.py", line 11 country = split_pair[0] IndentationError: unexpected indent

Jun 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here