-
Notifications
You must be signed in to change notification settings - Fork 0
python set
stachulemko edited this page Feb 21, 2023
·
1 revision
x = set()
n = set([0, 1, 2, 3, 4])
A.discard(2) # usuniecie elementy
A.add(5) # dodanie
A.clear() # czysczenie
zbior2 = zbior.copy() #kopiowanie
zbior1.union(zbior2) #łaczenie 2 zbirow
zbior1.intersection(zbior2) #Część wspólna dwóch zbiorów
lista1 = ['a', 2, 'b', 3, 'c', 1, 'a']
print(lista1)
zbior1 = set(lista1)
print(zbior1)
lista2 = list(zbior1)
print(lista2)