Chapter 6: Functions: The Tic-Tac-Toe Game


Download CD Content

Overview

Every program you've written so far has been one large, continuous series of instructions. Once your programs reach a certain size or level of complexity, it becomes hard to work with them this way. Fortunately, there are ways to break up big programs into smaller, manageable chunks of code. In this chapter, you learn one way of doing this by creating your own functions. Specifically in this chapter, you'll learn to do the following:

  • Write your own functions

  • Accept values into your functions through parameters

  • Return information from your functions through return values

  • Work with global variables and constants

  • Create a computer opponent that plays a strategy game




Python Programming for the Absolute Beginner
Python Programming for the Absolute Beginner, 3rd Edition
ISBN: 1435455002
EAN: 2147483647
Year: 2003
Pages: 194

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net