Question: PYTHON 3 The following code extracts the city populations that are larger than 10000 from the list of lists populationsSK and stores them in a
PYTHON 3

The following code extracts the city populations that are larger than 10000 from the list of lists populationsSK and stores them in a new list citiesSK. populationsSK = [['Pelican Narrows', 2703], [' Saskatoon', 222035], [' Moose Jaw', 33617], ['La Ronge', 5905]] citiesSK = [] for x in populationsSK: if x[1] >= 10000: citiesSK.append(x) At the end of the program, citiesSK is the list: [['Saskatoon', 222035], ['Moose Jaw', 33617]] (a) Modify the code so that it is an equivalent program in which the list citiesSK is created using a list comprehension instead of a loop. (b) Using a similar list comprehension, write an expression that creates a list of all the towns whose population is smaller than 40000. (c) Using a list comprehension, write an expression that creates a list of the all the names of the cities and towns (the new list should contain all the names, but no population data) (d) Using a list comprehension, write an expression that creates a list of all the towns and cities whose names are more than 8 characters (including blanks)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
