Please write in Python! Write a loop that prints each country\'s population in c
ID: 3759382 • Letter: P
Question
Please write in Python!
Write a loop that prints each country's population in country_pop. Sample output for the given program:
Please write in Python!
Write a loop that prints each country's population in country_pop. Sample output for the given program:
United States has 318463000 people. India has 1247220000 people. Indonesia has 252164800 people. China has 1365830000 people.Write a loop that prints each country's population in country_pop. Sample output for the given program: United States has 318463000 people India has 1247220000 people. Indonesia has 252164800 people. China has 1365830000 people 1 country-pop = { China": India' 'United States': 318463000, Indonesia' 1365830000, 1247220000, 4 : 252164800 6} # country populations as of 2014 7 8 print(country, 'has', pop, 'people.' ·
Explanation / Answer
country_pop = {
'China': 1365830000,
'India' : 1247220000
}
for items in country_pop.items():
country = items[0]
pop = items[1]
print country+' has '+str(pop)+ ' people.'