Discover Python, Part 6, Programming in Python

For the fun of it

From the developerWorks archives

Robert Brunner

Date archived: January 4, 2017 | 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 steps and illustrations may have changed.



static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Open source
ArticleID=97081
ArticleTitle=Discover Python, Part 6: Programming in Python
publish-date=10252005