Newcomer to Python tutorial question

Chris Rebert clp2 at
Thu May 7 20:40:57 CEST 2009

On Thu, May 7, 2009 at 11:35 AM, Alan Cameron <alan.cameron at>
wrote> I am not sure of this is the right place to ask a question
about the
> tutorial
> why is the printed result of
>>>> basket = {'apple', 'orange', 'apple', 'pear', 'orange', 'banana'}
>>>> print(basket)
> {'orange', 'banana', 'pear', 'apple'}
> in the sequence given?

Because it's *not a sequence* at all, it's a set. Sets are unordered
and contain no duplicate items, hence why the output ordering is
arbitrary and only the unique subset of original elements is present.

Further info:


More information about the Python-list mailing list