[issue4570] Bad example in set tutorial
Shashwat Anand
report at bugs.python.org
Wed Apr 7 04:50:44 CEST 2010
Shashwat Anand <anand.shashwat at gmail.com> added the comment:
I guess giving fruit, the set of unique fruit a different name makes it more clear. Comments alignment fixed.
>>> basket = {'apple', 'orange', 'apple', 'pear', 'orange', 'banana'}
>>> print(basket)
{'orange', 'bananna', 'pear', 'apple'}
>>> fruit = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana']
>>> uniquefruit = set(fruit) # create a set without duplicates
>>> uniquefruit
{'orange', 'pear', 'apple', 'banana'}
----------
nosy: +l0nwlf
Added file: http://bugs.python.org/file16793/datastructure.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4570>
_______________________________________
More information about the Python-bugs-list
mailing list