State in word game variables (and properties derived from that state)

Thinking about the example for insert_letter

>>> insert_letter("a", "__n_n_", "banana")
    '_anana'

The current “underscored” word, what I would call the “working word”, is a kind of state. What properties of the game are embedded in this state? For example, can we tell if the user has won? How?

Let’s develop a function has_won that takes the example hidden string as an argument and returns a boolean indicating if the user has won.

def has_won(working_word, guess_word):
    return working == guess_word

Why does this work? Recall that the working word maintains the “state” of the letters that haven’t been guessed (as underscores) and that winning is then same as having replaced all of the underscores.