i m getting "You should replace the dashes with letters I guessed correctly" error
which the code do replace the dashes with the letters
what m i doing wrong?
--------------------------------------
import random
words = ['apple' , 'orange', 'kiwi']
secret_word = (random.choice(words))
print "psst... : " + secret_word
def get_guess():
output = " "
players_lives = 5
while output != secret_word:
if check_progress_list == list(secret_word):
output = secret_word
print("You win!")
break
elif players_lives == 0:
print("You lose!")
break
else:
userInput = input("\nTry to Guess the Word!\n" + "You have " + str(players_lives) + " lives/guessess left\n" + str(check_progress_list) + '\n')
if userInput == secret_word:
output = secret_word
print("You win!")
break
elif len(userInput) > 1 and userInput != secret_word or userInput.isdigit() == True or len(userInput) < 1:
print('\nYou need to guess one LETTER at a time!')
players_lives -= 1
elif len(userInput) == 1 :
print('\nkeep going')
if userInput in secret_word:
print('"' + userInput + '"' +' is found in the answer\n')
print(check_progress(secret_word, check_progress_list, userInput))
else:
print('But ' + '"' + userInput + '"' +' is not found in the word and you have lost a life')
players_lives -= 1
else:
print " "
def check_progress(list_a, list_b, userInput):
for index, item in enumerate(list_a):
if item == userInput:
list_b[index] = userInput
return list_b
def update_dashes(secret_word):
my_list = [ ]
while len(my_list) < len(secret_word):
my_list.append('-')
return(my_list)
check_progress_list = (update_dashes(secret_word))
get_guess()