Linux Today: Linux News On Internet Time.
Search Linux Today
Linux News Sections:  Developer -  High Performance -  Infrastructure -  IT Management -  Security -  Storage -
Linux Today Navigation
LT Home
Contribute
Contribute
Link to Us
Linux Jobs


Top White Papers

More on LinuxToday


Python4Kids Blog: While

Jul 06, 2010, 17:03 (0 Talkback[s])
(Other stories by Brendan Scott)

[ Thanks to Brendan Scott for this link. ]

"The structure of a while statement is:
while :
    

"The program answers the question: is the condition true or false? If it is true, it does stuff in the section. When it is finished it goes back up to the top and repeats the process again and again until the condition is false:

>>> a = 10
>>> while a > 0:
...    a = a-1
...    print a
...
9
8
7
6
5
4
3
2
1
0
"The ordering here is a little odd because I forgot to print a in the first line."

Complete Story

Related Stories: