while
statement, execution
(1)Syntax:
while CONDITION: STATEMENT1 ... STATEMENTn
Example
# program with a while loop n = 0 while n < 20: print n, n = n+1
Operation:
evaluate CONDITION
, yielding
TRUE or FALSE
if CONDITION
is FALSE, exit
the while statement, and continue the program below the while
statement
if CONDITION
is TRUE, execute
STATEMENT1
,..,STATEMENTn
,
and go back to step 1