[Tutor] Re: high score lists

Andrei project5 at redrival.net
Fri Apr 15 08:26:09 CEST 2005

Alberto Troiano <albertito_g <at> hotmail.com> writes:

> I've read somewhere that the appropiate way to make a best score list is with
a dictionarie
> So you'll have something like this:
> best_score={"Peter":100,"Jhon":23} 

I don't see how that is in any way superior to a list of tuples. In fact, it has
distinct disadvantages, in that you'll have to do a 'lot' of work to get the
scores listed from high to low (which is what is usually done with them). The
situation would improve if you'd use the score as key and the player as value.
But even then it's still easier to keep them in a list of tuples, because it's
easier to do manipulations like "remove the lowest score" when you insert a
higher one.



More information about the Tutor mailing list