Previously we introduced the Python language using the interpreted mode and created our first program. Along the way we discovered how to assign variables and import modules. This time we're going to investigate code loops and a closely related subject, conditional statements.
Loops are a very important concept in any programming language. Almost every program will contain at least one loop. They are especially important in graphical user interface (GUI) and game programming.
There are number of looping scenarios. One is to repeat the code inside a loop a fixed number of times. Another is to loop until a specified loop condition is satisfied. Alternatively, a loop exit command can be issued depending on a particular program state. In this and subsequent articles we'll meet all three of these scenarios.
A post from my Learn Python on the Raspberry Pi tutorial.
No comments:
Post a Comment