Re: python loops
- From: AlbaClause <you@xxxxxxxxx>
- Date: Thu, 31 Aug 2006 14:56:23 -0400
Putty wrote:
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
for i in range(length):
print i
--
--
There are several things that I will never be:
* I will never be attracted to females.
* I will never enjoy the company of others.
Exactly how these realities bode for my enemy, is not of my concern.
.
- Follow-Ups:
- Re: python loops
- From: bearophileHUGS
- Re: python loops
- References:
- python loops
- From: Putty
- python loops
- Prev by Date: Re: Assignment-in-conditional
- Next by Date: Re: SQLObject or SQLAlchemy?
- Previous by thread: python loops
- Next by thread: Re: python loops
- Index(es):
Relevant Pages
|