Question: # MichiganCities.py - This program prints a message for invalid cities in Michigan. # Input: Interactive. # Output: Error message or nothing. # Initialized array

# MichiganCities.py - This program prints a message for invalid cities in Michigan.
# Input: Interactive.
# Output: Error message or nothing.
# Initialized array of cities in Michigan.
citiesInMichigan =["Acme", "Albion", "Detroit", "Watervliet", "Coloma", "Saginaw", "Richland", "Glenn", "Midland", "Brooklyn"]
foundIt = False # Flag variable.
# Get user input.
# name of city to look up in array.
inCity = input("Enter name of city: ")
# Write your loop here.
# Write your test statement here to see if there is
# a match. Set the flag to true if city is found.
# Test to see if city was not found to determine if
# "Not a city in Michigan." message should be printed.

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 Programming Questions!