Game Development Reference
In-Depth Information
instructions are executed. The normal flow of execution for a program is to start at the
top and execute each instruction going down one by one. But these flow control statements
can cause the flow to skip instructions, loop over instructions, or break out of loops.
Function calls also change the flow of execution by jumping to the start of a function.
The print() function, which displays text on the screen. Also, the input() function
can get text from the user through the keyboard. This is called I/O (pronounced like the
letters, "eye-oh"), because it deals with the input and output of the program.
And that's it, just those four things. Of course, there are many details about those four
types of instructions. In this topic you will learn about new data types and operators, new
flow control statements besides if , while and break , and several new functions. There
are also different types of I/O (input from the mouse, and outputting sound and graphics
and pictures instead of just text.)
For the person using your programs, they really only care about that last type, I/O. The
user types on the keyboard and then sees things on the screen or hears things from the
speakers. But for the computer to figure out what sights to show and what sounds to play, it
needs a program, and programs are just a bunch of instructions that you, the programmer,
have written.
A Web Page for Program Tracing
If you have access to the Internet and a web browser, you can go to this topic's website at
http://inventwithpython.com/traces you will find a page that traces through each of the
programs in this topic. By following along with the trace line by line, it might become more
clear what the Guess the Number program does. This website just shows a simulation of
what happens when the program is run. No actual code is really being executed.
Search WWH ::




Custom Search