Good afternoon, tell me how to implement the following: It is necessary to find certain combinations of letters in a word and later on in the derivation of this word, these combinations of letters are highlighted in a different color or make them bold. For example: powerful it is necessary to find ow and ful. The result should be p ow er ful .

word = "powerful" edd_word = [] for w in word: edd_word.append(w) if "o" and "w" in edd_word: # необходимо добавить исполняемую часть чтобы выделила сочетание OW if "f" and "u" and "l" in edd_word: # необходимо добавить исполняемую часть чтобы выделила сочетание FUL print () #вывод самого слова с выделенными частями. 

How to implement it?

  • What is your difficulty? How to find the substring index in a string? How to highlight a substring on the specified indices? (It’s better to ask these questions separately — search and coloring are not related) Do you want to receive colors in the terminal? - jfs
  • Difficulties: How to highlight a substring at the specified indices? - Ruslan Pavlyuk
  • in the comments to your own question do not put the information necessary to answer. Update your question instead, click edit - jfs
  • 2

0