"Terry Hancock" wrote: > Chinook wrote: > > >>> ta = [5, 15, 12, 10, 9] > > >>> for i in range(len(ta)): > > ... if ta[i] >= 10: > > ... ta[i] -= 10 > > ... else: > > ... ta[i] += 10 > > It's not exactly the same in that it doesn't change values in > place, but this is similar if you are only interested in the > values: > > ta = [t>=10 and t-10 or t+10 for t in ta]
Not quite; it differs for t==10. George -- http://mail.python.org/mailman/listinfo/python-list