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
Agata [3.3K]
4 years ago
7

#Write a function called population_density. The function #should take one parameter, which will be a list of #dictionaries. Eac

h dictionary in the list will have three #key-value pairs: # # - name: the name of the country # - population: the population of that country # - area: the area of that country (in km^2) # #Your function should return the population density of all #the countries put together. You can calculate this by #summing all the populations, summing all the areas, and #dividing the total population by the total area. # #Note that the input to this function will look quite long; #don't let that scare you. That's just because dictionaries #take a lot of text to define. #Add your function here!
Computers and Technology
1 answer:
Radda [10]4 years ago
3 0

Answer:

def population_density(dictionary_list):

     """ this function calculates the population density of a list of countries"""

    total_population= 0

    total_area= 0

    for country in dictionary_list:

           total_population += country['population']

           total_area += country['area']

    population_density = total_population / total_area

    return population_density

Explanation:

In python, functions are defined by the "def" keyword and a dictionary is used to hold immutable data key and its value. The for loop is used to loop through the list of dictionaries and the values of the country data and extracted with bracket notation.

You might be interested in
25 Points Discuss games you have played that have poor game design puzzles and how you might improve them.
Pavel [41]
Hey here is your long answer it’s worth 25points
Are video games good or bad for you? It can be both.

Video games are frowned upon by parents as time-wasters, and worse, some education experts think that these games corrupt the brain. Playing violent video games are easily blamed by the media and some experts as the reason why some young people become violent or commit extreme anti-social behavior. But many scientists and psychologists find that video games can actually have many benefits – the main one is making kids smart. Video games may actually teach kids high-level thinking skills that they will need in the future.

“Video games change your brain,” according to University of Wisconsin psychologist C. Shawn Green. Playing video games change the brain’s physical structure the same way as do learning to read, playing the piano, or navigating using a map. Much like exercise can build muscle, the powerful combination of concentration and rewarding surges of neurotransmitters like dopamine strengthen neural circuits that can build the brain.

According to Marc Palaus, author of the study published in Frontiers in Human Neuroscience, there is a broad consensus in the scientific community that playing video games not only changes how the brain performs, but also its structure.

Below are the good and bad effects of video games – their benefits and disadvantages, according to researchers and child experts:

The Benefits: Positive Effects of Video Games
When your child plays video games, it gives his brain a real workout. In many video games, the skills required to win involve abstract and high level thinking. These skills are not even taught at school.
3 0
4 years ago
A cashier distributes change using the maximum number of five dollar bills, followed by one dollar bills. For example, 19 yields
ki77a [65]

Answer:

numOnes = amountToChange % 5;

Explanation:

The modulus operator % returns the remainder after division.

To get the number of dollar bills, you need to know how much remains if you divide by 5. And that is exactly what the above statement does.

6 0
3 years ago
Read 2 more answers
What will be result of below if statement.
Ber [7]

Explanation:

pls check it ur answer hp u understand this

6 0
3 years ago
The objective of ____ testing is to identify and eliminate execution errors that could cause a program to terminate abnormally,
Ann [662]

Answer: I would say "user" is the correct answer

Explanation: This question is clearly talking about a computer program so the "user" is like a BETA tester. "Someone who tests games, websites, and apps before they are released.

3 0
3 years ago
What do flowcharts communicate to programmers ?
ziro4ka [17]

Answer:

how data will flow through the program

Explanation:

says the answer in the question

6 0
3 years ago
Other questions:
  • You're working at a large industrial plant and notice a tag similar to the one shown in the figure above. Which of the following
    5·1 answer
  • What type of Windows Server is the most likely server to be targeted by a computer hacker?
    13·2 answers
  • A snail goes up A feet during the day and falls B feet at night. How long does it take him to go up H feet? Given three integer
    8·1 answer
  • Which one of the following statements is correct? a. Web browsers cannot function without cookies. b. Cookies are text files and
    9·1 answer
  • Fill in the blanks. The ________________ donut chart shows the distribution across your website’s pages by the number of clicks
    14·1 answer
  • Sally needs to teach her class how to convert a decimal number to a binary number. What is the first step she should take to sta
    5·1 answer
  • A program uses two classes: dog and poodle. which class is the base class and which is the derived class?
    7·2 answers
  • Match each career to its various job roles. digital media coordinator digital media specialist photographer sound producer creat
    13·1 answer
  • Every single device can be connected to every other device on network, making the network mesh. This statement is True or False?
    8·1 answer
  • Can you please help me with this crossword puzzle, I am having trouble with numbers 5 down and 22 across.
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!