sorting a list and counting interchanges

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Thu Apr 7 13:44:49 EDT 2005


Tim's solution is very nice, it comes from basic things often taught in
good computer science courses.

In Python when you have to do many (-1)**n you can do:
(1-2*(n%2))
This seems quite faster.

Bearophile




More information about the Python-list mailing list