Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Need help with coding. Make a List ( 25 points) Write a program called citylist.py, in which the user inputs the names of cities, which
Need help with coding.
Make a List ( 25 points) Write a program called citylist.py, in which the user inputs the names of cities, which get added to a list. Your program should: - Include a comment in the first line with your name. - Include comments describing each major section of code. - Create a list - it should initially be empty. - Ask the user to input the name of a city or hit enter to end the list. - If the user adds the name of a city (i.e., anything other than a blank value): - Add the name to the list. - Tell the user that they've added [city] to the list (where [city] is the name that just got added). - Ask the user (again) to input a city name - and keep asking until the user hits enter without adding another name (i.e., enters a blank value). - Once the user enters a blank value: - Tell the user how many names they added to the list. - Using a for-loop, output all the names that are in the list, using a separate line for each name. - Do not include the blank value in the list Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started