Chapter 9Hangman

Image

In Chapter 8 we planned our Hangman game. Now let’s create the game as per the plan.

Game Time

We now understand how our Hangman game will work. We’ve planned and tested individual bits of code. Now we can put it all together.

Create a new file named Hangman.py. Here is the code (and yes, this is a longer one, close to 100 lines of code):

Image Tip

You Don’t Have to Type It All That’s a lot of code to type. If you’d like to do so, go for it. But if not, use this QR code to find the code on the book website. Then you can just copy ...

Get Captain Code: Unleash Your Coding Superpower with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.