Discover Python, Part 6, Programming in Python

For the fun of it

From the developerWorks archives

Robert Brunner

Date archived: May 15, 2019 | First published: October 25, 2005

This article explores the Python for loop. The for loop is used to iterate through the items in a Python collection, including the Python tuple, string, and list container types discussed in previous "Discover Python" articles. The for loop can also be used to access elements from a container type by using the range (or xrange) method. In addition, you can use the range method to execute a group of statements a specific number of times within a for loop.

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 content, steps, or illustrations may have changed.

Zone=Open source
ArticleTitle=Discover Python, Part 6: Programming in Python