ubsequent words def words_with_letters(words, letters): This problem is an excuse to introduce some general discrete math terminology that helps make many later problem speci0ications less convoluted and ambiguous. A substring of a string consists of characters taken in order from consecutive positions. Contrast this with the similar concept of subsequence of characters still taken in order, but not necessarily at consecutive positions. For example, each of the 0ive strings '', 'e', 'put', 'ompu' and 'computer' is both a substring and subsequence of the string 'computer', whereas 'cper' and 'out' are subsequences, but not substrings. Note how the empty string is always a substring of every possible string, including itself. Every string is always its own substring, although not a proper substring the same way how all other substrings are proper. Concepts of sublist and subsequence are de0ined for lists in an analogous manner. Since sets have no internal order on top of the element membership in that set, sets can meaningfully have both proper and improper subsets, whereas the concept of “subsetquence” might mean a subset that would be a subsequence, were the members of that set were written out sequentially in sorted order. Now that you know all that, given a list of words sorted in alphabetical order, and a string of required letters, 0ind and return the list of words that contain letters as a subsequence. letters Expected result (using the wordlist words_sorted.txt) 'klore' ['booklore', 'booklores', 'folklore', 'folklores', 'kaliborite', 'kenlore', 'kiloampere', 'kilocalorie', 'kilocurie', 'kilogramme', 'kilogrammetre', 'kilolitre', 'kilometrage', 'kilometre', 'kilooersted', 'kiloparsec', 'kilostere', 'kiloware'] 'brohiic' ['bronchiectatic', 'bronchiogenic', 'bronchitic', 'ombrophilic', 'timbrophilic'] 'azaz' ['azazel', 'azotetrazole', 'azoxazole', 'diazoaminobenzene', 'hazardize', 'razzmatazz']

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter15: Recursion
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question
100%

Subsequent words

def words_with_letters(words, letters):

This problem is an excuse to introduce some general discrete math terminology that helps make many later problem speci0ications less convoluted and ambiguous. A substring of a string consists of characters taken in order from consecutive positions. Contrast this with the similar concept of subsequence of characters still taken in order, but not necessarily at consecutive positions. For example, each of the 0ive strings '', 'e', 'put', 'ompu' and 'computer' is both a substring and subsequence of the string 'computer', whereas 'cper' and 'out' are subsequences, but not substrings.

Note how the empty string is always a substring of every possible string, including itself. Every string is always its own substring, although not a proper substring the same way how all other substrings are proper. Concepts of sublist and subsequence are de0ined for lists in an analogous manner. Since sets have no internal order on top of the element membership in that set, sets can meaningfully have both proper and improper subsets, whereas the concept of “subsetquence” might mean a subset that would be a subsequence, were the members of that set were written out sequentially in sorted order.

Now that you know all that, given a list of words sorted in alphabetical order, and a string of required letters, 0ind and return the list of words that contain letters as a subsequence.

letters

Expected result (using the wordlist words_sorted.txt)

'klore'

['booklore', 'booklores', 'folklore', 'folklores', 'kaliborite', 'kenlore', 'kiloampere', 'kilocalorie', 'kilocurie', 'kilogramme', 'kilogrammetre', 'kilolitre', 'kilometrage', 'kilometre', 'kilooersted', 'kiloparsec', 'kilostere', 'kiloware']

'brohiic'

['bronchiectatic', 'bronchiogenic', 'bronchitic', 'ombrophilic', 'timbrophilic']

'azaz'

['azazel', 'azotetrazole', 'azoxazole', 'diazoaminobenzene', 'hazardize', 'razzmatazz']
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Problems on Dynamic Programming
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning