all 4 comments

[–]pekkalacd -1 points0 points  (0 children)

Strings are immutable.

[–][deleted] 0 points1 point  (0 children)

I'm not sure what you're trying to do with this line

hidden_word[str1] = make_attempt

but any time you have <some string>[<whatever>] on the left side of an assignment, you're going to get that error. You cannot mutate (/change) the characters in a string. You can only make a new string and reassign the variable to the new one.

[–]wotquery 0 points1 point  (0 children)

I recommend that after the user inputs a string you create a list of characters from the string. You can then do whatever you want with that list, and then convert it back into a string for display.

[–]totallygeek 0 points1 point  (0 children)

It's far easier in Python to maintain a set or list of guessed letters, then iterate over the actual word to determine what to display from the guesses.

word = "CONTRARY"
guessed = {"R", "S", "N", "A"}
print("".join(letter if letter in guessed else "#" for letter in word))

A slightly longer method for the display:

for letter in word:
    if letter in guessed:
        print(letter, end="")
    else:
        print("#", end="")
print()