I am a very new to python and this will probably be easy for you to help me with. So I have a list "guessed" and I want to add the "guess" to it (this is a hangman game by the way), so It works fine for that go in hangman but in the next turn instead of adding another guess to the list it changes the guess.
guessed = []
guessed.extend(guess)
print (guessed)
This is more of my code that you will probably need:
while current != theword and lives > 0:
print ("You have %d lives left" % lives)
guess = input("Please input one letter or type 'exit' to quit.")
guess = guess.lower()
if guess == "exit":
break
guessed = []
guessed.append(guess)
print (guessed)
if guess in theword:
index = theword.find(guess)
x = list(current)
x[index] = guess
current = "".join(x)
print ("Correct!")
print(x)
print (guessed)
else:
print ("Incorrect, try again")
So if I were to guess "m" on the first go it would output "[m]" but then if I guess "a" it would output "[a]" instead of "[m, a]". I think I have to do a loop of something but I cant figure this out.
Thanks