1 # MichiganCities.py - This program prints a message invalid cities in Michigan. Summary 2 # Input: Interactive 3 # Output: Error message or nothing In this lab, you use what you have learned about searching a list to find an exact match to 4 complete a partially prewritten Python program. 5 # Initialized list of cities 6 citiesInMichigan = ["Acme", "Albion", "Detroit", "Watervliet", "Coloma", "Saginaw", "Richland", "Glen "Midland", "Brooklyn"] 7 The program uses a list that contains valid names for 10 cities in Michigan. You ask the user to enter a city name; your program then searches the list for that city name. If it is not found, the program should print a message that informs the user the city name is not found in the list of valid 8 # Get user input cities in Michigan. 9 inCity = input("Enter name of city: ") 10 11 The starter file provided for this lab includes input statements. You need to write code to examine 12 # Write your test statement here to see if there is 13 |14 # If the city is found, print "City found." 15 '16 # Otherwise, "Not a city in Michigan" message should all the items in the list and test for a match. You also need to determine if you should print the "Not a city in Michigan." message. Comments in the code tell you where to write your statements. printed. Instructions 1. Study the prewritten code to make sure you understand it. 2. Write a loop statement that examines the names of cities stored in the list. 3. Write code that tests for a match. 4. Write code that, when appropriate, prints the message "Not a city in Michigan.". 5. Execute the program using the following as input: Chicago Brooklyn Watervliet Acme
1 # MichiganCities.py - This program prints a message invalid cities in Michigan. Summary 2 # Input: Interactive 3 # Output: Error message or nothing In this lab, you use what you have learned about searching a list to find an exact match to 4 complete a partially prewritten Python program. 5 # Initialized list of cities 6 citiesInMichigan = ["Acme", "Albion", "Detroit", "Watervliet", "Coloma", "Saginaw", "Richland", "Glen "Midland", "Brooklyn"] 7 The program uses a list that contains valid names for 10 cities in Michigan. You ask the user to enter a city name; your program then searches the list for that city name. If it is not found, the program should print a message that informs the user the city name is not found in the list of valid 8 # Get user input cities in Michigan. 9 inCity = input("Enter name of city: ") 10 11 The starter file provided for this lab includes input statements. You need to write code to examine 12 # Write your test statement here to see if there is 13 |14 # If the city is found, print "City found." 15 '16 # Otherwise, "Not a city in Michigan" message should all the items in the list and test for a match. You also need to determine if you should print the "Not a city in Michigan." message. Comments in the code tell you where to write your statements. printed. Instructions 1. Study the prewritten code to make sure you understand it. 2. Write a loop statement that examines the names of cities stored in the list. 3. Write code that tests for a match. 4. Write code that, when appropriate, prints the message "Not a city in Michigan.". 5. Execute the program using the following as input: Chicago Brooklyn Watervliet Acme
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
![1 # MichiganCities.py - This program prints a message
invalid cities in Michigan.
Summary
2 # Input: Interactive
3 # Output: Error message or nothing
In this lab, you use what you have learned about searching a list to find an exact match to
4
complete a partially prewritten Python program.
5 # Initialized list of cities
6 citiesInMichigan = ["Acme", "Albion", "Detroit",
"Watervliet", "Coloma", "Saginaw", "Richland", "Glen
"Midland", "Brooklyn"]
The program uses a list that contains valid names for 10 cities in Michigan. You ask the user to
enter a city name; your program then searches the list for that city name. If it is not found, the
7
program should print a message that informs the user the city name is not found in the list of valid
8 # Get user input
cities in Michigan.
9 inCity = input ("Enter name of city: ")
10
11
The starter file provided for this lab includes input statements. You need to write code to examine
12 # Write your test statement here to see if there is
all the items in the list and test for a match. You also need to determine if you should print the
13
"Not a city in Michigan." message.
|14 # If the city is found, print "City found."
15
Comments in the code tell you where to write your statements.
'16 # Otherwise, "Not a city in Michigan" message should
printed.
Instructions
1. Study the prewritten code to make sure you understand it.
2. Write a loop statement that examines the names of cities stored in the list.
3. Write code that tests for a match.
4. Write code that, when appropriate, prints the message "Not a city in Michigan.".
5. Execute the program using the following as input:
Chicago
Brooklyn
Watervliet
Acme](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F5b4afaba-eeab-4f16-8fe3-57d1f7966dfc%2F080856d9-f940-4152-aa45-78ada247bcab%2Fip0zbyj_processed.png&w=3840&q=75)
Transcribed Image Text:1 # MichiganCities.py - This program prints a message
invalid cities in Michigan.
Summary
2 # Input: Interactive
3 # Output: Error message or nothing
In this lab, you use what you have learned about searching a list to find an exact match to
4
complete a partially prewritten Python program.
5 # Initialized list of cities
6 citiesInMichigan = ["Acme", "Albion", "Detroit",
"Watervliet", "Coloma", "Saginaw", "Richland", "Glen
"Midland", "Brooklyn"]
The program uses a list that contains valid names for 10 cities in Michigan. You ask the user to
enter a city name; your program then searches the list for that city name. If it is not found, the
7
program should print a message that informs the user the city name is not found in the list of valid
8 # Get user input
cities in Michigan.
9 inCity = input ("Enter name of city: ")
10
11
The starter file provided for this lab includes input statements. You need to write code to examine
12 # Write your test statement here to see if there is
all the items in the list and test for a match. You also need to determine if you should print the
13
"Not a city in Michigan." message.
|14 # If the city is found, print "City found."
15
Comments in the code tell you where to write your statements.
'16 # Otherwise, "Not a city in Michigan" message should
printed.
Instructions
1. Study the prewritten code to make sure you understand it.
2. Write a loop statement that examines the names of cities stored in the list.
3. Write code that tests for a match.
4. Write code that, when appropriate, prints the message "Not a city in Michigan.".
5. Execute the program using the following as input:
Chicago
Brooklyn
Watervliet
Acme
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY
Expert Answers to Latest Homework Questions
Q: Get correct answer with general accounting
Q: What is the materials cost per equivalent unit?
Q: Please give me answer with accounting question
Q: i need correct option
Q: Not use ai given answer accounting
Q: Tina's budgeted overhead for the month
Q: General accounting question
Q: What is the company's unit contribution margin
Q: Hi expert please give me answer general accounting question
Q: none
Q: What is the total amount of current liabilities of this financial accounting question?
Q: General Account tutor please find solution
Q: A business sells coffee mugs at $20 per unit. The
costs per unit are:
.
Direct materials = $6.00
•…
Q: Kings Company has total assets of $240,000 and total liabilities of $80,000. The company's…
Q: General accounting question with answer
Q: Help with general accounting question
Q: No Ai
Q: General accounting question
Q: Need help with this question solution general accounting
Q: Hi expert please given correct answer with accounting question
Q: Rena Company reports total assets and total liabilities of $251,000 and $110,000, respectively, at…