The syntax
Python provides two repetition statements, while
and for
. We will
consider while
first. The syntax for the while
statement is,
while test-expression : statement
Or, in words, the while
statement consists of the
keyword while
followed by a test expression, terminated by a colon,
followed by a statement (simple or compound) that will be executed as
long as the text expression is True
. Note that the statement(s)
following while must be indented.