The reason why it is ending abruptly is because it's checking on a character by character basis rather than checking the whole word then deciding if the guess was incorrect.
Here's my code for this solution, documented so you can understand:
basically, have a variable that acts as a switch, when you have a correct guess switch it, then have a check after the 'for' loop to see whether a life needs to be taken away or not.
You can see that this is what I'm doing with the 'correct' variable that I create before the loop, and check following.
Hope this helps ^.^
Connor
edit:
i'm going to break this down a little bit so that it's not a huge dump :P
Check the code if you can't make sense of this.
You receive input, test that it is one letter, and do the doohickey with the display.
checking over each character is...
#we need to check if we need to take a life away
correct = False
This is where the 'switch' I talked about is created, just a Boolean variable.
#loop through the word to guess, character by character.
for char in word:
#if the character is in the old display, add it to the new on.
if char in lastdisplay:
display += char
Here, if the character was displayed beforehand we will bring it up on the new display.
#if the character is in the guess, add it to the display.
elif char in guess:
display += char
#we made a correct guess!
correct = True
If the guessed character is the character that we are currently checking add it to the display, and flip the switch to 'True'
#otherwise we need to add a blank space in our display.
else:
if char == ' ':
display += ' ' #space
else:
display += '_' #empty character
Otherwise, nothing has happened, add in a space/blank and continue on with the loop.
#if we didn't get a correct letter, take a life.
if not correct:
lives -= 1
Here's were we check the 'switch', if it is 'True', we don't need to take a life,
Otherwise the 'switch is 'False' and we take a life.