Question: Project: QUESTION 1: Write a function symmetric_words(wlist) that takes a single argument wlist containing a list of words each in the form of an all-lowercase
Project:
QUESTION 1:
Write a function symmetric_words(wlist) that takes a single argument wlist containing a list of words each in the form of an all-lowercase non-empty str, and returns a sorted list of "symmetric" words. A symmetric word is defined as a word where for all values , the letter positions from the start of the word and the letter positions from the end of the word are equidistant from the respective ends of the alphabet.
For example, bevy is a symmetric word as: b (1 position from the start of the word) is the second letter of the alphabet and y (1 position from the end of the word) is the second-last letter of the alphabet; and e (2 positions from the start of the word) is the fifth letter of the alphabet and v (2 positions from the end of the word) is the fifth-last letter of the alphabet.
Example outcome:
1. >>> print(symmetric_words(["boy", "dog", "bevy", "bully"])) ['bevy']
2. >>> print(symmetric_words(["neither", "a", "borrower", "nor", "a", "lender", "be"])) []
QUESTION 2:
Write a function unique_long_words(wlist, wlen)that takes two arguments:
wlist containing a list of words (each in the form of an all-lowercase str)
wlen which specifies a minimum word length as an int
The function should return the number of unique words contained in wlist which are of length wlen or greater.
Example outcome:
1. >>> print(unique_long_words(["the", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"], 3)) 8
2. >>> print(unique_long_words(["how", "much", "wood", "could", "a", "wood", "chuck", "chuck"], 2)) 5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
