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]
3 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]3 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
Advantages of a personal area network
Ratling [72]
The main advantage is the security, the pan is a personal network of one or two person so there is no risk of any leak of data, best way to share resources each other via bluetooth

4 0
3 years ago
What is online school like 3 sentences
lara [203]

Answer:

its okay. i mean like you have to do a bunch off stuff. andsomtimes it gets a little boring.

Explanation:

i am doing online school.

3 0
3 years ago
Read 2 more answers
The set of rules for how computers talk to one another is called
lianna [129]
Protocol. Like TCP/IP or HTTP etc
6 0
3 years ago
Why aren’t I leveling up? I have enough points and even a brainliest. Could an expert please help me!! I am really confused.
svlad2 [7]
This actually happened to me when I was supposed to be an expert. Answer one more question, log out and back in, and then you should be the next rank!
Hope this helps! Have a happy holiday!
8 0
3 years ago
If a database was being used to track sales, a customer who buys a lot of items would be a good example of how two tables could
3241004551 [841]

Answer:True

Explanation:

7 0
2 years ago
Other questions:
  • Question: Henry wants to change the configuration information of an application. Which file should Henry edit to change this inf
    15·1 answer
  • A set of communication rules for the computer to follow is called, what?
    10·2 answers
  • _______ refers to the poitically, religiously, or ideologically motivated use of computers (or related technology) by an individ
    15·1 answer
  • If your network subnet mask is /16, what is the maximum number of host ids available for this network?
    15·1 answer
  • Advantage and disavantage of malware maintenance
    12·1 answer
  • Create a Python program in a file named loops1.py that does the following: a. Use a while loop to keep asking the user for input
    14·2 answers
  • Q. Which protocol would best serve to authorize users to access directory services?
    8·1 answer
  • Which programming language represents data in the form of a series of zeros and ones​
    7·1 answer
  • Identify a statement that accurately differentiates between short-term memory and working memory.
    15·1 answer
  • Which very high-speed fiber network was already in place and being used for wide area networking (wan) transmissions, before the
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!