[New-bugs-announce] [issue39705] Tutorial, 5.6 Looping Techniques, sorted() example

Mirwi report at bugs.python.org
Fri Feb 21 04:24:31 EST 2020


New submission from Mirwi <mirwi at binary-kitchen.de>:

>>> basket = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana']
>>> for f in sorted(set(basket)):
...     print(f)
...
apple
banana
orange
pear

Shouldn't 'apple' appear two times as basket is a list that allows duplicates, not a set?

I'm just doing my first steps into Python and may be mislead. In that case, sorry for the fuzz.

----------
assignee: docs at python
components: Documentation
messages: 362395
nosy: docs at python, mirwi
priority: normal
severity: normal
status: open
title: Tutorial, 5.6 Looping Techniques, sorted() example
type: enhancement
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39705>
_______________________________________


More information about the New-bugs-announce mailing list