A Byte of Python

The Hangman Gaming Room

This is our first start of the Hangman. Let us write a simple 'Hello World' style introduction to the game itself.

#!/usr/bin/env python 
# Filename: hangman1.py 
 
print '''--- Welcome to the Hangman Game ---''' 

Output

$ python hangman1.py
--- Welcome to the Hangman Game ---

Note

What we see in the 'Output' section is the result after hitting Ctrl-E in DrPython or by running python on the command line as shown above.

How It Works

This is our first touch to the Hangman game. We have already used the print statement before - here, we use it to display a welcome message whenever the game is run.

We will continue to add more to this program in the 'Hangman Gaming Room' section in all the subsequent chapters.