Question
The program must be written in Python3 language. Problem C. (10 points) Front Tooth Concealment You have recently been appointed vice-principal of a high school,
The program must be written in Python3 language.
Problem C. (10 points) Front Tooth Concealment
You have recently been appointed vice-principal of a high school, and as such, you have the honor of helping out with their graduation ceremony. You will alternate reading off the names of the graduates with the principal. Unfortunately, you got your front teeth knocked out last night while fighting crime as a masked vigilante, so you are unable to pronounce any name containing the letters s or z. Since you dont want your enemies to learn of your secret identity, and you suspect that some of them may be present at the graduation, you need to avoid saying any names containing the letters s or z. You will read the first name from the list of graduates, meaning that you will also read the third, the fifth, the seventh, and so on. Therefore, you must ensure that all names at odd positions in the list of names (or at even indexes, since we start indexing at 0), do not contain the letters s or z.
Write a function no_front_teeth(names_list) which takes in a list of strings representing the names of the students in the order they will be read. no_front_teeth should return a new list containing the same set of names, except rearranged such that the strings at all even indexes do not contain the characters 's', 'z', or their upper case variants, 'S' or 'Z'. If this is not possible because there are too many names that contain s or z, the function should instead print the string "Mission impossible: too many unpronounceable names", and return an empty list.
Hints:
-
Separate the names into two lists: names that contain s or z, and names that dont. Then recombine them in an order that avoids any names containing s or z in even indexed spots.
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