1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| >>> def buildSet(chaine):
... return set(chaine.split())
...
>>> mySet = buildSet('un deux deux trois')
>>> print mySet
set(['un', 'trois', 'deux'])
>>> mySet = mySet.union(buildSet('one two three two'))
>>> print mySet
set(['un', 'trois', 'deux', 'one', 'three', 'two'])
>>> mySet = buildSet('one two three two')
>>> print mySet
set(['three', 'two', 'one'])
>>> def buildSet(chaine):
... return set(chaine.split(' '))
...
>>> mySet = buildSet('un deux deux trois')
>>> print mySet
set(['un', 'trois', 'deux'])
>>> mySet = mySet.union(buildSet('one two three two'))
>>> print mySet
set(['un', 'trois', 'deux', 'one', 'three', 'two'])
>>> mySet = buildSet('one two three two')
>>> print mySet
set(['three', 'two', 'one'])
>>> |