This chapter covers
Python provides a complete set of control-flow elements, with loops and conditionals. This chapter examines each in detail.
You’ve come across the basic while loop several times already. The full while loop looks like this:
while condition: bodyelse: post-code
condition is an expression that evaluates to a true or false value. As long as it’s True, the body will be executed repeatedly. If it evaluates to False, the while loop will ...