How to make a reverse for loop in python?

Thoma rf.egnaro at evetsrellum
Sat Sep 20 12:27:55 EDT 2008


Alex Snast a écrit :
> Hello
> 
> I'm new to python and i can't figure out how to write a reverse for
> loop in python
> 
> e.g. the python equivalent to the c++ loop
> 
> for (i = 10; i >= 0; --i)

for (i = 0; i < 10; i--) -> for i in range(10):

for (i = 10; i >= 0; --i) -> for i in range(10,-1,-1):

Thoma



More information about the Python-list mailing list