Python Programming for the Absolute Beginner, 3rd Edition
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
Категории