Closed selmabensaid closed 5 years ago
This is because of the order of your logic:
game['masked_word']=uncover_word
(game['previous_guesses']).append(letter.lower())
if letter.lower() not in game['answer_word'].lower():
(game['remaining_misses'])-=1
return game
All of that is placed after your code that raises GameWonException/GameLostException, as a result if one of those exceptions is raised none of that code is executed. What that means is that this code:
if answer_word==masked_word or remaining_misses==0:
raise GameFinishedException()
will never be able to have the second half of the or
be true, because your code never reaches a state where remaining_misses
would equal 0. (If it's 1 and what they guess isn't in answer_word
you raise GameLostException
, the code that decrements remaining_misses
to zero is never reached)
I am not passing the last test of the hangman game. the error message says: Did not raise game finished exception. Can you please help me understand why?
Assignment: http://learn.rmotr.com/python/post-a-question/post-your/questions
User code: