Why does this not run in python shell?

You need to call the function.

What like say hangman (cat)?

Yup.

hangman("test")

Awww done it. Thank you mate

In the future, it is a lot easier for us to help if you copy-paste your code instead of a screenshot

Thanks.