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
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: Please answer do fast and step by step calculation for this financial accounting question
Q: Financial Accounting: How does benefit realization tracking enhance performance measures? 1) Value…
Q: Provide answer general accounting
Q: How much is net cash provided
Q: Need help this question
Q: General accounting
Q: Gest Inc. has provided the following data for the month of November. The balance in the Finished…
Q: If Interval Railway's fixed costs total $40,000 per month, the variable cost per passenger is $55,…
Q: Need help with this general accounting question
Q: It is important to understand the concept of spirituality in social work practice as well as how the…
Q: Financial Accounting Question please answer
Q: Please answer the general accounting question not use ai
Q: The manufacturing direct labour efficiency variance ?
Q: Variable overhead:08, fixed overhead:11
Q: (c) The following data have been obtained for the hydrolysis of sucrose, C12H22O11, to
glucose,…
Q: What is the average collection period in days ? General accounting
Q: (III) adsorbent
(b) Adsorption of the hexacyanoferrate (III) ion, [Fe(CN)6] ³, on y-Al2O3 from…
Q: What is the average collection period in days ?
Q: Need answer
Q: Provide answer
Q: The Flapjack Corporation