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...
icon
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
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
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
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 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)
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
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY

Expert Answers to Latest Homework Questions

Q: Price Level P2 Use the following graph to answer the next question. a P₁ b AD Y₁ Y2 Y3 Real GDP It…
Q: At the beginning of the year, Myrna Corporation (a calendar year taxpayer) has E & P of $32,000. The…
Q: During their senior year at Clarkson College, two business students, Gerry Keating and Louise…
Q: Given the loop transfer function below L(s)=110(s+1)/(s+10)^2 Compute the parameters τp and τz to…
Q: A controller is designed so that the nominal closed-loop transfer function has bandwidth 1.9 rad/s…
Q: Given a plant P(s)=−3s+1s+a and a model for measureable output disturbance d with transfer function…
Q: A controller is designed so that the nominal closed-loop transfer function has bandwidth 1.9 rad/s…
Q: Select all that are true    A) A PID controller can always be written as an observer-based…
Q: SE AB analysis. Determine the current in the 50 and 30 resistor for the circuit shown below using…
Q: Compute the payback statistic for Project B if the appropriate cost of capital is 13 percent and the…
Q: 3. The Buckaroo Company faces the following inverse demand curve for its patented product known as a…
Q: No chatgpt used
Q: import socket def authenticate_user(tcp_socket):    while True:        response =…
Q: Provide and explanation for the solution provided and the steps it takes to solve this problem…
Q: typing
Q: Question 10 You've been asked to order branded shirts for all the employees in your company. You've…
Q: Question 10 You've been asked to order branded shirts for all the employees in your company. You've…
Q: Market Quantity Supplied for Firm W, Firm X, Firm Y, and Firm Z Table: Firm W's Firm X's Firm Y's…
Q: Carrying forward the same data... A Solar panel installation on a warehouse costs $10,000 to…
Q: 9. Name this organ. L 10. Specific sublayer - right at the arrow's tip! D W & a X prt sc hom FB FLO
Q: 10. Use the Venn diagram to organize information about the Northwest A BY D) E) Ordinance and the…