Adding an element to a set (add)
examples/sets/add_elements.py
objects = set() print(objects) objects.add('Mars') print(objects) objects.add('Mars') print(objects) objects.add('Neptun') print(objects)
set() {'Mars'} {'Mars'} {'Neptun', 'Mars'}
objects = set() print(objects) objects.add('Mars') print(objects) objects.add('Mars') print(objects) objects.add('Neptun') print(objects)
set() {'Mars'} {'Mars'} {'Neptun', 'Mars'}