[Tutor] Set changing order of items?
Adam Cripps
kabads at gmail.com
Fri Jan 19 21:05:31 CET 2007
On 1/19/07, Simon Brunning <simon at brunningonline.net> wrote:
> On 1/19/07, Adam Cripps <kabads at gmail.com> wrote:
> > I'm adding strings to a Set to prevent duplicates. However, the
> > strings are meant to be in the correct order. When I add the string to
> > the Set, the order seems to change (and I don't seem to be able to
> > predict what order they are in).
>
> Sets, like dictionaries, hold their items in an arbitrary order - see
> <http://tinyurl.com/a2nkg>.
OK - thanks for that - so it seems that using a Set will complicate
the matter more.
Really, I want to have a set of sets which won't have any duplicates.
An example might look something ilke this:
sums = [['1) 10 + 2 =', '12'], ['2) 13 + 4 =', '17']]
return sums
How might I achieve this list, without the duplicates (the duplicate
bit is the bit I'm stuck on).
Adam
--
http://www.monkeez.org
PGP key: 0x7111B833
More information about the Tutor
mailing list