On May 4, 7:33 pm, John Yeung <gallium.arsen...@gmail.com> wrote: > 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
You're right... I only tested cases when number of people playing outnumbered the number of byes that week. Anyways, I'm new to programming and this has been a good learning experience. Next time around, I'll be sure to thoroughly comment my code before I ask for help on it. I really appreciate all the help that you've offered so far. Right now, I'm debating whether I should try to reinvent the round_robin generator part of the code or whether there still might be a way to shuffle the results of the generated output so that I can slice it effectively. -- http://mail.python.org/mailman/listinfo/python-list