Hello! So, just as the title says, how do I replace a specific index position? If you look at the bottom where it says
blankword.replace(blankword[i],guess), that is what I’m having trouble with. I think I know why it doesn’t work, but I don’t know what else to do. All characters in the list (except for the spaces) are “-”, so I can’t tell it to replace a specific character, I need to replace a specific position with a letter, with the value of “guess”.
p.s. i know my code is a mess. i basically just started it.
#hang #print("+----+\n|\n|\n|\n|") #man #print("\O/\n |\n/ \\") wordlist =  blankword =  print("\n") print("+----+\n| \O/\n| |\n| / \\\n|\n\n") word = ("hello world") word = "".join(list(word)) for i in word: if i != " ": h = i.replace(i,"-") wordlist.append(i) blankword.append(h) elif i == " ": blankword.append(i) wordlist = "".join(wordlist) blankword = "".join(blankword) print(word) #remove print(wordlist) #remove print(blankword) #keep guess = input() for i in range(len(word)): if (word[i] == guess): print(i) #remove blankword.replace(blankword[i],guess) print(blankword) #remove print(blankword)