Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

language: python Function Name: foodDesertLocator Parameters: cities ( list ) Returns: city_list (list) Description: A food desert is an area that has limited access to

language: python

image text in transcribed

Function Name: foodDesertLocator Parameters: cities ( list ) Returns: city_list (list) Description: A food desert is an area that has limited access to affordable and nutritious food; in other words, there aren't grocery stores within a certain mile radius to provide food to the people who live there. Write a function that takes in a list of cities and the number of peo- ple who are in that city without access to fresh food. Your function should first calculate the average number of people affected and then return a list of the city names with populations above that average. Note: The length of the list can vary! The list will be structured as follows: the name of the city, followed by that city's population, and so on. You can assume that every city will be fol- lowed by its population. >>> cities = ['San Francisco', 125000, 'Chicago', 500000, 'Atlanta', 2000000] >>> foodDesertLocator(cities) ['Atlanta'] >>> cities = ['New York City', 3000000, 'Atlanta', 2000000, 'Detroit', 30000, New Orleans', 50000] >>> foodDesertLocator(cities) ['New York City', 'Atlanta']

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions