> I am playing with Python. Playing as in learning. > Is it possible to reverse a range sequence? If, for instance, I > call: > > for f in range( 1,5 ): > print f > > Is it possible to reverse it? As in: > 4 > 3 > 2 > 1
Yes, there is a normally unused third parameter to range used to control the step size. It can bew negative so: range(4,0,-1) does what you want... Alan G. _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
