Métodos úteis do tipo set em Python

This commit is contained in:
Luiz Otávio
2022-11-03 07:45:44 -03:00
parent 8c02a11641
commit 0e4d9db702

View File

@@ -28,6 +28,14 @@
# Métodos úteis:
# add, update, clear, discard
s1 = set()
s1.add('Luiz')
s1.add(1)
s1.update(('Olá mundo', 1, 2, 3, 4))
# s1.clear()
s1.discard('Olá mundo')
s1.discard('Luiz')
print(s1)
# Operadores úteis:
# união | união (union) - Une