Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The for loop in Python is more like a foreach iterative-type loop in a shell scripting language than a traditional for conditional loop that works like a counter. Python's for loop takes what we will later describe as a sequence type (list, tuple, or string) and iterates over each element of that sequence.
>>> print 'I like to use the Internet for:' I like to use the Internet for: >>> for item in ['e-mail', 'net-surfing', 'homework', 'chat']: … print item … e-mail net-surfing homework chat