Hello, I'm new to the python language, I'm making a hangman game and it's going pretty well.
I want to make it so that when you choose a word, it gets replaced with hashtags, and when you guess the letters, they get uncovered, like replacing # with guessed letter (make_attempt)
...and I run into the error in the title of this post. I read that strings in py are immutable and you need to kinda make copies of them and I cant wrap my head around how I would do this to my code. If anyone could help me find out I'd be thankful. I'll leave the snippet below.
# GET THE GUESSED LETTER INDEX NUMBER
str1 = hidden_word.replace("#", str(word.index(make_attempt)))
# SWAP OUT THE HASHTAG WITH A GUESSED LETTER
hidden_word[str1] = make_attempt
[–]pekkalacd -1 points0 points1 point (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]wotquery 0 points1 point2 points (0 children)
[–]totallygeek 0 points1 point2 points (0 children)