Question: PYTHON Change the function, citiesState(locLst,st) where locLst is a list of cities and states in the following format: city, state There can be any number

PYTHON

Change the function, citiesState(locLst,st) where locLst is a list of cities and states in the following format: city, state There can be any number of spaces before and after the city and state strings. Find all cities in the state given by st and return a list as shown below note cities should be shown without beginning or trailing spaces. States in the list can be in upper, lower or any combination of upper and lower case but the st variable will always be upper case. If the state is not in the city, state list the string State not in list is returned.

PYTHON Change the function, citiesState(locLst,st) where locLst is a list of cities

1st Chicago iL', South Bend In Dekalb il', Sycamore IL New Lenox IL Minnea opolis MN Cities State (lst, IL Chicago is at 0 DeKalb is at 2 Sycamore is at 3 New Lenox is at 4'] 1st Chicago i L', DeKalb Ga', Sycamore IL Minnea opolis MN' Cities State (lst, GA') DeKalb is at 1 Cities State (lst, WI') 'State not in list

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!