13.1k views
5 votes
Write a loop that prints each country's population in country_pop. Sample output for the given program 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.

User Forpas
by
5.1k points

2 Answers

0 votes

Answer:

Code is as follows

country_pop={"United States": 318463000, "Indonesia" : 25216480, "India" : 1247220000, "China": 1365830000}

for key,value in country_pop.items(): print(key +" has "+ str(value) +" people.")

User Jabacchetta
by
5.2k points
3 votes

for country, pop in country_pop.items():

User Evan Hobbs
by
5.1k points