This video explains the sets in python
Complete playlist:
https://www.youtube.com/watch?v=n_F-_atStj8&list=PLLYZEFeS7wKiSN566R0keHLwucMmyXdqR
=============================== Notes =====================================
set is a mutable collection (its contents can be changed) which can store any type of values but only unique values can be stored and duplicated values will be discarded
set can be created either by using function or by curly bracket {}
st = set()
or
st = {11, "Sumit", 1.5, True}
print(st)
to add an element in set:
st.add(22)
print(st)
to remove an element from the set:
st.remove(22)
print(st)
Note: sets don't support indexing
Тэги:
##python ##dwarkacodingclub ##dwarka