Newcomer to Python tutorial question
Florian Wollenschein
Florian.Wollenschein at FernUni-Hagen.de
Thu May 7 14:42:20 EDT 2009
Alan Cameron wrote:
> I am not sure of this is the right place to ask a question about the
> tutorial
>
> http://docs.python.org/3.0/tutorial/datastructures.html#sets
>
> why is the printed result of
>
>>>> basket = {'apple', 'orange', 'apple', 'pear', 'orange', 'banana'}
>>>> print(basket)
> {'orange', 'banana', 'pear', 'apple'}
>
> in the sequence given?
>
A set is not ordered and eliminates duplicate elements. So the output is
random in terms of the order and only shows each single item once...
Correct me if I'm wrong :-)
Listick
http://www.listick.org
More information about the Python-list
mailing list