Write a Python program to do the following: Create an empty list named my_strings . Use a
Fantastic news! We've Found the answer you've been seeking!
Question:
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 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.
- Print all strings entered by the user (print the whole list) on the same line.
- 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.
- 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
Related Book For
Systems analysis and design
ISBN: 978-0136089162
8th Edition
Authors: kenneth e. kendall, julie e. kendall
Posted Date: