On May 4, 8:56 pm, Ross <ross.j...@gmail.com> wrote: > Anyways, you're right that seq[0] is always evaluated. > That's why my algorithm works fine when there are odd > numbers of players in a league.
It doesn't work fine for all odd numbers of players. For example, 15 players on 3 courts should result in 5 byes. But what actually happens with your code is that you get 4 byes or 8 byes, depending on whether you've got floating-point division enabled. So the way you are selecting byes does not even guarantee that you'll allocate the correct number of active matches for the number of courts, and this is due to the fact that the extended slice is too "coarse" a tool for the task. Now, it may be that for you, the number of players and courts is always within a confined range such that extended slicing and your magic constants will work. That's fine for you, but we weren't given that information. I haven't even begun to look at what happens for doubles. John -- http://mail.python.org/mailman/listinfo/python-list