I'm building a simple hangman game right now, and I want to be able to identify where in a list a user guesses a specific letter. For example, if the word list was [D,R,A,G,O,N] -- and the user guesses A, I want to be able to get a return that would say 4...this is my failed code so far
import random
word_list = ['red', 'better', 'white', 'orange', 'time']
hidden_list = []
selected_word = random.choice(word_list)
letters = len(selected_word)
selected_word_list = list(selected_word)
game_playing = True
print('My word has ' + str(letters) + ' letter(s).')
print(selected_word_list)
for i in selected_word_list:
hidden_list.append('_')
while game_playing:
print(hidden_list)
guess = input('What letter do you want to guess?')
if guess in selected_word_list:
print('Nice guess!')
else:
print('Nope!')