Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 165
Image: ubuntu2004
Kernel: Python 3 (system-wide)
s = """ALASKA Anchorage ALABAMA Huntsville Trussville ARIZONA Chandler Flagstaff Gilbert Mesa Peoria Scottlsdale CALIFORNIA Brea Burbank Campbell Carlsbad Carmichael Castro Valley Ceres Claremont Clovis Downey Encino Fresno Fullerton Garden Grove Hollister Huntington Bch Irvine Lake Elsinore Lemoore Los Angeles Palo Alto Pasadena Rancho Cucamonga Redondo Beach Roseville Sacramento Salinas San Diego San Francisco San Jose Santa Clarita Santa Cruz Santa Fe Springs South Gate Stockton Sunnyvale Thousand Oaks Universal City Vacaville Watsonville West Covina COLORADO Broomfield CONNECTICUT Avon Darien Farmington Glastonbury Milford Newington DISTRICT OF COLUMBIA Washington DELAWARE Christiana Newark Wilmington FLORIDA Celebration Clearwater Davie Daytona Beach Doral Fort Myers Ft. Lauderdale Maitland Naples Orlando Palm Beach Gardens Pembroke Pines Sarasota St. Augustine Tampa West Palm GEORGIA Alpharetta Atlanta HAWAII Honolulu ILLINOIS Bensenville Chicago Geneva Lombard Orland Park Plainfield Rosemont Springfield Wheeling INDIANA Bloomington Castleton Greenwood Indianapolis KANSAS Leawood KENTUCKY Louisville Newport MASSACHUSETTS Andover Beverly Boston Braintree Brockton Burlington Cambridge Canton Chelmsford Framingham Hingham Holliston Lexington Mansfield Marlborough Medfield Medford Needham Newton North Andover North Attleboro Norwood Peabody Plymouth Reading Swampscott Waltham West Roxbury Westborough Woburn MARYLAND Bel Air Brentwood Columbia Gaithersburg Timonium White Marsh MAINE Bangor South Portland MICHIGAN Grand Rapids Lansing Livonia Rochester Hills Sterling Hts Utica MINNESOTA Burnsville Eden Prairie Maple Grove Maplewood Minneapolis Otsego St. Paul MISSOURI Branson Des Peres Kansas City St. Louis NORTH CAROLINA Friendly Ctr Greenville Havelock Jacksonville Pineville Rocky Mount Wilson NEBRASKA Lincoln NEW HAMPSHIRE Manchester Nashua Salem NEW JERSEY Bayonne Bergenfield Cherry Hill Hazlet Jersey City Marlton Mt. Laurel Nutley Sayreville Sicklerville Wanaque NEW MEXICO Albuquerque Rio Rancho NEVADA Las Vegas North Las Vegas Reno Sparks NEW YORK Colonie Getzville Hopewell Junction New York New York Mills Queens Syosset Yonkers OHIO Canton Centerville Cincinnati Columbus Dayton Mason Norwood Strongsville Toledo W Chester Westlake Worthington OKLAHOMA Bartlesville PENNSYLVANIA Cranberry Twp Exton Glen Mills Huntingdon Valley Langhorne North Wales Pittsburgh Plymouth Meeting Springfield Trevose W Homestead Wayne Wyomissing RHODE ISLAND Warwick SOUTH CAROLINA Greenville Greer TENNESSEE Chattanooga Cordova Franklin Knoxville Murfreesboro, TEXAS Allen Austin Bryan Dallas El Paso Frisco Garland Grapevine Houston Irving Odessa Plano Shenandoah Southlake UTAH Midvale Murray Salt Lake Salt Lake City VIRGINIA Fairfax Richmond Springfield Virginia Beach VERMONT Shelburne WASHINGTON Bellevue Lacey Seattle WISCONSIN Brookfield"""
import re print('States', len([location for location in s.split('\n') if re.search('[A-Z][A-Z][A-Z\s]+', location)])) print('cities', len([location for location in s.split('\n') if not re.search('[A-Z][A-Z][A-Z\s]+', location)]))
States 40 cities 248