python loops

Putty jaysherby at gmail.com
Thu Aug 31 14:48:05 EDT 2006


In C and C++ and Java, the 'for' statement is a shortcut to make very
concise loops.  In python, 'for' iterates over elements in a sequence.
Is there a way to do this in python that's more concise than 'while'?

C:
for(i=0; i<length; i++)


python:
while i < length:
			i += 1




More information about the Python-list mailing list