import colorama
from colorama import Fore, Back, Style
colorama.init()
question_four = "\n4. After you have died, what would you most like people to do when they hear your name? \n"
answers_four = ["ASK for more stories about your adventures", "i DON'T CARE what people think of me after I'm dead, it's what they think of me while I'm alive that counts", "Think with ADMIRATION of your achievements", "MISS you, but smile"]
answers_house_a = ["ask", ...]
answers_house_b = ["don't care", ...]
answers_house_c = ["admiration", ...]
answers_house_d = ["miss", ...]
I would like to color the CAPITALIZED words within the variable answers_four. As I have 20 of those question variables and 20 related answers lists, adding Fore.CYAN + "String" + Fore.RESET to each word I want to color is not an option. Below is what I have managed so far which is printing the answers in cyan but not the specific parts of the strings.
for x in answers_four:
print(f"{Fore.CYAN}" + x)
Prints (in cyan):
ASK for more stories about your adventures
i DON'T CARE what people think of me after I'm dead, it's what they think of me while I'm alive that counts
Think with ADMIRATION of your achievements
MISS you, but smile
Your question is a bit hard to understand, but I think what you're asking is for every capitalized word in
answer_fourto be printed in cyan (and for every other word to be printed normally).You could do this like this:
Output:
(You can't copy colored text into the question, but it colors the capitalized words cyan.)
You could also do this more concisely, for example like this:
EDIT
From the OP's comments, I understand that they have a list of lists storing their sentences, and wish for that to be printed:
This could be done in multiple ways, for example: