Question
Can someone help write this in python Write a function most_dense_bigger_than that takes a list of dictionaries countries and a number area. The list of
Can someone help write this in python
Write a function most_dense_bigger_than that takes a list of dictionaries countries and a number area. The list of dictionaries represents data about countries (described below), and the area parameter represents a square mileage. The function returns the name of the country that is the most dense in terms of population out of the countries that have at least area land area. We define the population density of a country as its population divided by its land area.
Assume there are no ties, and the list contains at least one element.
This data is from Wikipedia.
An example of a list of dictionaries representing data about countries is:
countries = [ { 'name': "USA", 'population': 330000000, 'area': 3800000}, { 'name': "China", 'population': 1400000000, 'area': 3700000}, { 'name': "Tuvalu", 'population': 10300, 'area': 10 } ]
We would expect that most_dense_bigger_than(countries, 100) would return "China", and most_dense_bigger_than(countries, 0) would return "Tuvalu". Your function should work for any input list of countries.
Write appropriate assert tests to demonstrate that your program works as expected. Weve provided a small number of autograder tests to help you, but they dont comprehensively cover the behavior of the function, which you are responsible for testing thoroughly.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started