1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Genrish500 [490]
4 years ago
7

Write a loop that prints each country's population in country_pop. Sample output with input:

Computers and Technology
1 answer:
Nostrana [21]4 years ago
4 0

Answer:

  1. country_pop = {
  2.    'China': 1365830000,
  3.    'India': 1247220000,
  4.    'United States': 318463000,  
  5.    'Indonesia': 252164800
  6. }  
  7. for key in country_pop:
  8.    print(key + " has " + str(country_pop[key]) + " people")

Explanation:

The solution code is written in Python 3.

Given a dictionary, country_pop with data that includes four country along with their respective population (Line 1-6). We can use for in loop structure to traverse through each of the key (country) in the dictionary and print their respective population value (Line 7-8). The general loop structure through is as follow:

                    for key in dict:

                         do something

One key will be addressed for each round of loop and we can use that key to extract the corresponding value of the key (e.g. country_pop[key]) and print it out.

You might be interested in
What does limited access to a document mean?
OverLord2011 [107]
Limited access to a document usually means that the creator of the document is able to limit how much access one person is able to get.
8 0
3 years ago
Read 2 more answers
Mike wants to build an amplifier. Which technology can he use?
RSB [31]

Answer: The component that is used for most amplifiers is the transistor. Semiconductors like gold,copper etc. are used although poor semiconductors like silicon are sometimes used as well. There are many electronic circuits that all under the amplifier category. The classification of an amplifier depends on the size of the signal and configuration.

8 0
3 years ago
What is considered necessary to establish OSHA
irakobra [83]
OSHA (the Occupational Safety and Health Administration) is a part of the US Department of Labor that establishes, issues, and enforces national workplace safety regulatio…ns. These are designed to make job areas and practices safer for US workers.
4 0
4 years ago
I love the brainly update guys! :)
earnstyle [38]

Answer:

you mind if i take these points?

Explanation:

3 0
3 years ago
Read 2 more answers
Is orange named after the fruit or of the color?
Alexeev081 [22]
I slick thinks it’s because of its color
4 0
3 years ago
Other questions:
  • What is Software? Write the functions of Software?​
    11·1 answer
  • You are configuring a switch that has three hosts attached to FastEthernet 0/2 through 0/4. All three hosts are part of a public
    10·1 answer
  • Consider a binary-search method in an array that reports whether an object is in the array. The documentation indicates that the
    11·1 answer
  • The site is not allowing me to purchase the subscription. Please help?
    12·1 answer
  • Coral Given three floating-point numbers x, y, and z, output x to the power of y, x to the power of (y to the power of z), the a
    6·1 answer
  • Web design and development tools
    13·1 answer
  • At which track meet did two runners finish in a time equivalent to the mode?
    14·1 answer
  • Compiler is an example of​
    5·1 answer
  • WILL GIVE BRAINLIEST!! NO LINKS!!!
    12·2 answers
  • True of false that the memory of laptop is normally measured in kilobytes
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!