Game Development Reference
In-Depth Information
Topics Covered In This Chapter:
Methods
The
append()
list method
The
lower()
and
upper()
string methods
The
reverse()
list method
The
split()
string method
The
range()
function
The
list()
function
for
loops
elif statements
The
startswith()
and
endswith()
string methods.
The dictionary data type.
key-value pairs
The
keys()
and
values()
dictionary methods
Multiple variable assignment, such as a, b, c = [1, 2, 3]
This game introduces many new concepts. But don't worry; we'll experiment with these
programming concepts in the interactive shell first. Some data types such as strings and
lists have functions that are associated with their values called methods. We will learn
several different methods that can manipulate strings and lists for us. We will also learn
about a new type of loop called a
for
loop and a new type of data type called a dictionary.
Once you understand these concepts, it will be much easier to understand the game in this
chapter: Hangman.
You can learn more from Wikipedia: http://en.wikipedia.org/wiki/Hangman_(game)