Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Python program to do the following: Create an empty list named my_strings . Use a while loop to populate the my_strings list with

Write a Python program to do the following:

  1. Create an empty list named my_strings.  Use a while loop to populate the my_strings list with as many strings as the user wishes to enter. The user should be able to stop the loop by entering the string EXIT . The list should only include the intended strings the user wants to add to the list. Note: You MUST use a while loop for this step. The string EXIT should NOT be an element added to the list. 
  2. Print all strings entered by the user (print the whole list) on the same line.
  3.  Search the my_strings list for the string Winter .  Print the message “Found a match:  “ followed by the actual matched string (the actual string entered by the user)  as many times as there is a match. Otherwise, if there is no match, no messages should be printed (do not print anything if there is no match). Note: You MUST use a for loop for this step. Note: the search logic should NOT be case sensitive.
  4. Use a for loop to loop through the list to extract the second and fourth and last characters of each string. On separate lines, print each string in all upper case followed by three spaces , followed by its second character, followed by three hyphens, followed by its fourth character, followed by three hyphens, followed by its last character. Note: You MUST use a for loop for this part. 

                            For example, one line of output for part 4 will look like the line below:

                                           PYTHON   y--- h---n

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Code Step 1 Create an empty list named mystrings mystrings Step 2 Use a while loop to populate the m... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Systems analysis and design

Authors: kenneth e. kendall, julie e. kendall

8th Edition

135094909, 013608916X, 9780135094907, 978-0136089162

More Books

Students also viewed these Programming questions

Question

Define economic feasibility

Answered: 1 week ago