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.
Learn more about our help with Assignments: Python
Comments
Assignment Expert
14.02.18, 15:21
James, no difference in the code, just other variables names.
james
14.02.18, 06:37
for country,pop in country_pop.items(): ##This works.
Assignment Expert
24.01.18, 20:58
$ python3 Python 3.5.2 (default, Nov 23 2017, 16:37:01) [GCC 5.4.0
20160609] on linux Type "help", "copyright", "credits" or "license"
for more information. >>> country_pop={"United States": 318463000,
"India" : 1247220000, "Indonesia" : 25216480, "China": 1365830000 }
>>> >>> for key,value in country_pop.items(): print(key +" has "+
str(value) +" people.") ... China has 1365830000 people. India has
1247220000 people. United States has 318463000 people. Indonesia has
25216480 people. >>>
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
James, no difference in the code, just other variables names.
for country,pop in country_pop.items(): ##This works.
$ python3 Python 3.5.2 (default, Nov 23 2017, 16:37:01) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> country_pop={"United States": 318463000, "India" : 1247220000, "Indonesia" : 25216480, "China": 1365830000 } >>> >>> for key,value in country_pop.items(): print(key +" has "+ str(value) +" people.") ... China has 1365830000 people. India has 1247220000 people. United States has 318463000 people. Indonesia has 25216480 people. >>>
this doesnt work