Discover Python, Part 5, Programming in Python

Controlling the flow

From the developerWorks archives

Robert Brunner

Date archived: January 4, 2017 | First published: September 20, 2005

Begin exploring how to do things in Python. This article focuses on flow control, which is one of the simplest methods for writing programs. In this programming model, data is manipulated -- perhaps from a user interface, sensors, or a file; depending on the value of the data or resulting expressions, different actions are taken. Python provides several flow control mechanisms. This article discusses the if statement, and the while and for loops.

This content is no longer being updated or maintained. The full article is provided "as is" in a PDF file. Given the rapid evolution of technology, some steps and illustrations may have changed.



static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Open source, Web development
ArticleID=94136
ArticleTitle=Discover Python, Part 5: Programming in Python
publish-date=09202005