Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Adding an element to a set (add)

objects = set()
print(objects)

objects.add('Mars')
print(objects)

objects.add('Mars')
print(objects)

objects.add('Neptun')
print(objects)

Output:

set()
{'Mars'}
{'Mars'}
{'Neptun', 'Mars'}