O'Reilly logo

Python Without Fear, First Edition by Brian Overland

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

4. Decisions and Looping

To write any but the most elementary programs, you need to be able to make decisions. Programmers have a special term for decision-making abilities: control structures. A control structure determines whether a computer will turn left or turn right, in other words, whether it will continue to operate on a set of data or exit out of a loop.

This chapter explores some of the basics of decision-making and looping within Python.

Image if and elif

Image Looping with while

Breaking from a loop

A Python guessing game, illustrating these ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required