Python implementation of hangman