Help with a problem on a personal project

def game():
    word_list = ["triangle", "horse"]
    word = random.choice(word_list)
    for letter in word:
        print("_")

Can I make this function print the “_” side by side so that the output is something like this: " _ _ _ _ _ "?

Sounds like you are asking for technical advice on a subject not well understood. Is this the case?

Yes, I have no idea how I could change that my desired output.

1 Like

Python has a repeat operator that works sort of like multiplication…

>>> print ('_' * 40)
________________________________________
>>> 

Substitute len(word) for 40.

1 Like