#Write a function called population_density. The function #should take one parameter, which will be a list of #dictionaries. Each 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!

Answers

Answer 1

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.


Related Questions


​what are the morals and ethics of computer

Answers

Answer:

Computer ethics is a part of practical philosophy concerned with how computing professionals should make decisions regarding professional and social conduct. Margaret Anne Pierce, a professor in the Department of Mathematics and Computers at Georgia Southern University has categorized the ethical decisions related to computer technology and usage into three primary influences:

The individual's own personal code.

Any informal code of ethical conduct that exists in the work place.

Exposure to formal codes of ethics.

Explanation:

Suppose that the tuition for a university is $10,000 this year and increases 4% every year. In one year, the tuition will be $10,400. Write a program using for loop that computes the tuition in ten years and the total cost of four years’ worth of tuition after the tenth year.

Answers

Answer:

The programming language is not stated; however, I'll answer using Python programming language (See attachment for proper format)

tuition = 10000

rate = 0.04

for i in range(1,15):

tuition = tuition + tuition * rate

if i <= 10:

print("Year "+str(i)+" tuition:",end=" ")

print(round(tuition,2))

if i == 14:

print("Tuition 4th year after:",end=" ")

print(round(tuition,2))

Explanation:

The first 2 lines initializes tuition and rate to 10000 and 0.04 respectively

tuition = 10000

rate = 0.04

The next line iterates from year 1 to year 14

for i in range(1,15):

This line calculates the tuition for each year

tuition = tuition + tuition * rate

The next 3 lines prints the tuition for year 1 to year 10

if i <= 10:

print("Year "+str(i)+" tuition:",end=" ")

print(round(tuition,2))

The next 3 lines prints the tuition at the 4th year after year 10 (i.e. year 14)

if i == 14:

print("Tuition 4th year after:",end=" ")

print(round(tuition,2))

Your task is to write and test a function which takes one argument (a year) and returns True if the year is a leap year, or False otherwise. The seed of the function is already sown in the skeleton code in the editor. Note: we've also prepared a short testing code, which you can use to test your function. The code uses two lists - one with the test data, and the other containing the expected results. The code will tell you if any of your results are invalid.

Answers

Answer:

function isLeapYear( aYear ){

   var confirmYear=  year % 400 === 0 || (year % 100 !== 0 && year % 4 === 0);

   return confirmYear ? True : False;

}

Explanation:

The javascript function above requires an argument which is the year when it is passed, it is analyzed, counting the number of days in that year and a boolean value of true or false is dynamically assigned to the variable 'confirmYear'.

The ternary operator would logically select the right value, which is outputted to the user. To test the function, use the console to call the function with an argument.

console.log( isLeapYear( 1999 ) );

Define a function pyramid_volume with parameters base_length, base_width, and pyramid_height, that returns the volume of a pyramid with a rectangular base. Sample output with inputs: 4.5 2.1 3.0

Answers

Answer:

def pyramid_volume(base_length,base_width,pyramid_height):

      return base_length * base_width * pyramid_height/3

length = float(input("Length: "))

width = float(input("Width: "))

height = float(input("Height: "))

print("{:.2f}".format(pyramid_volume(length,width,height)))

Explanation:

This line declares the function along with the three parameters

def pyramid_volume(base_length,base_width,pyramid_height):

This line returns the volume of the pyramid

      return base_length * base_width * pyramid_height/3

The main starts here

The next three lines gets user inputs for length, width and height

length = float(input("Length: "))

width = float(input("Width: "))

height = float(input("Height: "))

This line returns the volume of the pyramid in 2 decimal places

print("{:.2f}".format(pyramid_volume(length,width,height)))

Class B { Public: Void b1(); Protected: Void b2(); }; Class A : public B { Public: Void a1(); Protected: Void a2(); }; Class C: public A { Public: Void c1(); }; Void main () { B temp1; A temp2; C temp3; } a) Name all member functions of all classes visible through temp1 in the main function? b) Name all member functions of all classes visible through temp2 in the main function? c) Name all member functions of all classes visible through temp3 in the main function? d) Which class is the parent of class A? e) Which class is the child of class A?​

Answers

Answer:

write the questions a little clear we can't read it

what was the main purpose of napiers bone?​

Answers

Answer:

Napier's bones is a manually-operated calculating device created by John Napier of Merchiston, Scotland for the calculation of products and quotients of numbers. The method was based on lattice multiplication, and also called 'rabdology', a word invented by Napier.

Answer:

The main purpose of napiers bone is to fine products and quotient of divisions.

Which is an appropriate strategy for using a workplace blog?

A. Use a professional tone.

B. Use an informal tone in internal blogs.

C. Treat internal blogs as personal communication.

Answers

Answer:

a

Explanation:

An approprbiate strategy for using a workplace blog is to use a professional tone. The correct option is a.

What is a professional tone?

Professional writing is a sort of writing that aims to quickly communicate information and ideas in a professional setting. It is straightforward and succinct. Professional writing aims to inform or persuade a reader about the business and work worlds.

Business writers should aim for an overall tone that is assured, respectful, and sincere; that employs emphasis and subordination effectively; that contains nondiscriminatory language; that emphasizes the "you" attitude.

It is written at a degree of difficulty that is suitable. Internal corporate communications, legal documents, business reports, governmental regulations, and scripts for the entertainment sector are typical examples of professional writing.

Therefore, the correct option is A. Use a professional tone.

To learn more about professional tone, refer to the link:

https://brainly.com/question/1278496

#SPJ2

var tax = .07;

var getCost = function(itemCost, numItems) {

var subtotal = itemCost * numItems;

var tax = 0.06;

var total = subtotal + subtotal * tax;

return (total);

}

var totalCost = getCost(25.00, 3);

alert("Your cost is $" + totalCost.toFixed(2) + " including a tax of " +

tax.toFixed(2));


Which variable represents the function expression?


a. totalCost

b. getCost

c. itemCost

d. total

Answers

Answer:

b. getCost

Explanation:

Javascript is a multi-purpose programming language, used in applications like web development, software development and embedded system programming, data visualization and analysis, etc.

Its regular syntax defines variables with the "var" keyword and with additional ecmascript rules, the "let" and "const" keywords as well. function definition uses the keyword "function" with parenthesis for holding arguments. The code block of a function is written between two curly braces and returns a value stored in a variable with the return keyword.

The variable can now be called with the parenthesis and required arguments. Note that only anonymous functions can assigned to a variable.

What is the output of the following Python program? try: fin = open('answer.txt') fin.write('Yes') except: print('No') print('Maybe')

Answers

(<ANSWER RETRACTED>)

Which of the following is true about sorting functions?
A. The most optimal partitioning policy for quicksort on an array we know nothing about would be selecting a random element in the array.
B. The fastest possible comparison sort has a worst case no better than O(n log n)
C. Heapsort is usually best when you need a stable sort.
D. Sorting an already sorted array of size n with quicksort takes O(n log n) time.
E. When sorting elements that are expensive to copy, it is generally best to use merge sort.
F. None of the above statements is true.

Answers

Answer: Option D -- Sorting an already sorted array of size n with quicksort takes O(n log n) time.

Explanation:

Sorting an already sorted array of size n with quicksort takes O(n log n) time is true about sorting functions while other options are wrong.

CHALLENGE 7.1.1: Initialize a list. ACTIVITY Initialize the list short.names with strings 'Gus', Bob, and 'Ann'. Sample output for the given program Gus Bob Ann 1 short_names- Your solution goes here 2 # print names 4 print(short_names[0]) 5 print(short names [11) 6 print(short_names[2])

Answers

Answer:

short_names = ["Gus", "Bob", "Ann"]

print(short_names[0])

print(short_names[1])

print(short_names[2])

Explanation:

There are some typos in your code. In addition to the missing part of the code, I corrected the typos.

First of all, initialize the list called short_names. The list starts with "[" and ends with "]". Between those, there are must be the names (Since each name is a string, they must be written between "" and there must be a semicolon between each name)

Then, you can print each name by writing the name of the list and the index of the names between brackets (Index implies the position of the element and it starts with 0)

Write a CREATE VIEW statement that defines a view named InvoiceBasic that returns three columns: VendorName, InvoiceNumber, and InvoiceTotal. Then, write a SELECT statement that returns all of the columns in the view, sorted by VendorName, where the first letter of the vendor name is N, O, or P.

Answers

Answer:

CREATE VIEW InvoiceBasic  AS

SELECT VendorName, InvoiceNumber, InvoiceTotal  

FROM Invoices JOIN Vendors ON Invoices.InvoiceID = Vendors.VendorID  

WHERE left(VendorName,1) IN ('N' , 'O ' , 'P' )

Explanation:

CREATE VIEW creates a view named InvoiceBasic  

SELECT statements selects columns VendorName, InvoiceNumber and InvoiceTotal   from Invoices table

JOIN is used to combine rows from Invoices and Vendors table, based on a InvoiceID and VendorsID columns.

WHERE clause specified a condition that the first letter of the vendor name is N, O, or P. Here left function is used to extract first character of text from a VendorName column.

Pleaseeeeee helppppp meeeeeeee
Tomorrow is my examination.​
Please don't ignore.

Answers

Answer:

Floppy disk

Pendrive

sd card

CD

Router

Explanation:

Hope it is helpful

A technique that uses data that is labeled to train or teach a machine.
Reinforcement
Unsupervised
Supervised

Answers

Answer:

computer.

Explanation:

it uses data that is labeled to train.

In which type of hacking does the user block access from legitimate users without actually accessing the attacked system?

Answers

Complete Question:

In which type of hacking does the user block access from legitimate users without actually accessing the attacked system?

Group of answer choices

a. Denial of service

b. Web attack

c. Session hijacking

d. None of the above

Answer:

a. Denial of service

Explanation:

Denial of service (DOS) is a type of hacking in which the user (hacker) blocks access from legitimate users without actually accessing the attacked system.

It is a type of cyber attack in which the user (an attacker or hacker) makes a system or network inaccessible to the legitimate end users temporarily or indefinitely by flooding their system with unsolicited traffic and invalid authentication requests.

A denial of service is synonymous to a shop having a single entry point being crowded by a group of people seeking into entry into the shop, thereby preventing the legitimate customers (users) from exercising their franchise.

Under a DOS attack, the system or network gets stuck while trying to locate the invalid return address that sent the authentication requests, thus disrupting and closing the connection. Some examples of a denial of service attack are ping of death, smurf attack, email bomb, ping flood, etc.

9. If you want to change the Header text of any Form then which property will you use
a) Header b) Text c) Name d) Font

Answers

Answer:

header

Explanation:

i would use header

Assign a variable solveEquation with a function expression that has three parameters (x, y, and z) and returns the result of evaluating the expression Z-y + 2 * x. 2 /* Your solution poes here */ 4 solveEquation(2, 4, 5.5); // Code will be tested once with values 2, 4, 5.5 and again with values -5, 3, 8

Answers

Answer:

The programming language is not stated;

However, the program written in Python is as follows

def solveEquation(x,y,z):

     result = z - y + 2 * x

     print(result)

x = float(input("x = "))

y = float(input("y = "))

z = float(input("z = "))

print(solveEquation(x,y,z))

Explanation:

This line defines the function solveEquation

def solveEquation(x,y,z):

This line calculates the expression in the question

     result = z - y + 2 * x

This line returns the result of the above expression

     print(result)

The next three lines prompts user for x, y and z

x = float(input("x = "))

y = float(input("y = "))

z = float(input("z = "))

This line prints the result of the expression

print(solveEquation(x,y,z))

list three components of a computer system​

Answers

Central Processing Unit,
Input devices and
Output devices.


Your car must have two red stoplights, seen from ______ feet in the daytime, that must come on when the foot brake is pressed.
A. 100
B. 200
C. 300
D. 400

Answers

Answer:

the answer is 300 feet in the daytime

1. Trình bày các mô hình mối đe dọa trong hệ thống viễn thông

Answers

Explanation:

please subscribe to my mom channel please

i request you

Where in the Formula tab on the ribbon would you find the Use in Formula function?
Function library
Formula Auditing
Calculation
Defined Names

Answers

Answer:

Defined Names

Explanation:

Just did it on Edg 2020

The Formula tab on the ribbon can be found in Defined Names in formula function. The correct option is D.

What is formula tab?

The formula tab is where you can insert functions, outline the name, generate the name, review the formula, and so on.

The Formulas tab on the ribbon contains critical and useful functions for creating dynamic reports. Function Library, Defined Names, Formula Auditing, and Calculation are all included.

The Formula tab is where we insert functions, define names, create name ranges, and review formulas. The Formulas tab in the ribbon contains very important and useful functions for creating dynamic reports.

The Formula command is located in the Data group on the Table Tools, Layout tab. When you open a document that contains a formula in Word, the formula automatically updates.

The Formula tab on the ribbon can be found in the formula function's Defined Names.

Thus, the correct option is D.

For more details regarding formula tab, visit:

https://brainly.com/question/20452866

#SPJ5

Why MUST you request your DSO signed I-20 ship as soon as it is ready and who is responsible to request the I-20

Answers

Why MUST you request your DSO signed I-20 ship as soon as it is ready and who is responsible to request the I-20?

a. It is required you have an endorsed/signed I-20 when Customs and Border Patrol or police ask for it

b. We only keep an unsigned digital copy and cannot sign an I-20 after the fact

c. It is against U.S. regulations to send digital (signed or not) DS-2019s and must treat I-20s the same

d. You will need all signed original I-20s to make copies to apply for OPT, STEM and H-1B in the future, so get them now!

e. It is the student’s choice to request each term, however, we cannot go back retroactively to provide past copies

f. We can only provide a signed copy of current I-20 and if changes occur from previous semesters that information will not show

g. The original endorsed I-20 signed by a DSO will be destroyed after 30 days of issuance if not picked up, and it cannot be replicated

h. The cost to have I-20 shipped may go up at any time

i. All the above

Answer:

i. All the above

Explanation:

DSO means designated school officials and they have to do with Student and Exchange Visitor Program (SEVP)-certified schools where students have to get a Form I-20, “Certificate of Eligibility for Nonimmigrant Student Status which provides information about the student's F or M status.

What a student must request for from his DSO signed I-20 ship are all the above options.

Universal Containers will be using multiple environments to manage the development, testing, and deployment of new functionality to sales users. Which deployment tool can be used to migrate metadata across Salesforce environments

Answers

Answer:

1. Force.com IDE

2. change sets

Explanation:

1. Force.com IDE is an integrated development environment. It is useful for creating applications on the force.com using metadata. it uses text based files to constitute the different parts of Salesforce.

2. change sets:

these can send configuration from one between different Salesforce organizations. It migrates changes in metadata between different organizations.

What protocol communicates data between routers representing the edges of autonomous systems?Distance-vectorLink stateInterior gatewayExterior gateway

Answers

Explanation:

Exterior gateway protocol are the routing protocols that are used on the internet for exchanging routing information among the autonomous system. These autonomous systems can be gateway protocol, vector routing protocol.

The protocol that communicates data between routers representing the edges of autonomous systems is called Exterior Gateway Protocol (EGP).

Here,

An autonomous system (AS) is a collection of routers that are under a single administrative domain and have a common routing policy. These autonomous systems can be Internet Service Providers (ISPs), large organizations, or even smaller networks.

EGP is specifically designed to exchange routing information between routers that are at the edges of these autonomous systems. It allows routers in different autonomous systems to communicate with each other and share information about the best paths to reach various network destinations.

Know more about Autonomous system,

https://brainly.com/question/30240559

#SPJ6

An organization is planning to implement a VPN. They want to ensure that after a VPN client connects to the VPN server, all traffic from the VPN client is encrypted. Which of the following would BEST meet this goal?a. Split tunnelb. Full tunnelc. IPsec using Tunnel moded. IPsec using Transport mode

Answers

Answer:

B. Full tunnel.

Explanation:

In this scenario, an organization is planning to implement a virtual private network (VPN). They want to ensure that after a VPN client connects to the VPN server, all traffic from the VPN client is encrypted. The best method to meet this goal is to use a full tunnel.

A full tunnel is a type of virtual private network that routes and encrypts all traffics or request on a particular network. It is a bidirectional form of encrypting all traffics in a network.

On the other hand, a split tunnel is a type of virtual private network that only encrypts traffic from the internet to the VPN client.

Hence, the full tunnel method is the most secured type of virtual private network.

7. Which control is used to display multiple records in List Form
a) Data Grid View b) Textbox c) Label d) Button

Answers

Answer:

I think a is correct answer.

Answer:

A

Explanation:

Say you have a long string and you want to collect all of the letters within it without storing duplicates. What would be the most appropriate type to store the letters in?
a. a set
b. a list
c. the original string
d. a dictionary

Answers

A set because sets do not allow duplicated elements

Write a job back with my best Interest

Answers

Answer:

be a doctor

Explanation:

u will help people and save them and get paid

why is Touchpad used in the laptop computer​

Answers

Answer:

in controlling the mouse or cursor

Explanation:

as is it known tha a cursor is a poniting device. and the only way to control it without a mouse is the touchpad

I keep getting this error: postfix.cpp: In function ‘double RPN_evaluation(std::string)’: postfix.cpp:42:26: error: cannot convert ‘__gnu_cxx::__alloc_traits > >::value_type {aka std::basic_string }’ to ‘char’ for argument ‘1’ to ‘int isOperand(char)’ if(isOperand(expr.at(g))){ ^ postfix.cpp:96:1: warning: control reaches end of non-void function [-Wreturn-type] } I am not sure what I am doing wrong, help please

Answers

Answer:

expr.at(g) returns a string, not a char. They are not the same thing and that is what the compiler is complaining about.

Other Questions
In _____ research, a group of people of one age is compared to a group of people who are another age. A ball is dropped from a height of 14 ft. The elasticity of the ball is such that it always bounces up one-third the distance it has fallen. (a) Find the total distance the ball has traveled at the instant it hits the ground the fourth time. (Enter an exact number.) A list of pulse rates is 70, 64, 80, 74,92. What is the median for this list? Non-native species can be declared an invasive species under what act, triggering federal aid and action to curtail the problem In a bag of M&MS there are 4 green, 6 yellow and 8 blue candies. What is the probability of drawing a blue then a green if you replace the candy after the draw? Find 14.6 + 8.52I really need help !!!! Please help me from 1 to 20 please calculate the number of moles equivalent to 20.0 gram of calcium phosphate please help Fill in the blanks and explain the pattern 0,1,1,2,3,5,__,__,21,34,55 Mechanical energy is the sum of energy and energy in a system Consider the given function and the given interval. f(x) = 8 sin x - 4 sin 2x, [0,pi] (a) Find the average value f ave of f on the given interval. (b) Find c such that f ave = f(c). the atomic number of a nucleus increases during which nuclear reactions Define tense with its main type Consider the following points. (4, 1) and (4, 2) Let Y'O' be the image of YO after a reflection across line . Suppose that is located at (1, 4) and is located at (2, 4). Which of the following is true about line ? Why is it important to the United States during this time to influence Latin American nations? Someone plz help me Im stuck with this one T^T "What is the difference between the revertible and nonrevertible rII mutants that Benzer generated?" Find the value of x.A. 86B. 172C. 94D. 188 Find y. A. 63 B. 33 C. 233 D. 3 what are the methods used in biodegrable waste managment? plz amswer i will give brainliest if u answer im using my last points