23 lines
651 B
Org Mode
23 lines
651 B
Org Mode
:PROPERTIES:
|
|
:ID: 3a41407c-661e-416a-80d2-4c7a137d153a
|
|
:END:
|
|
#+title: python-set
|
|
#+filetags: :python:notes:
|
|
|
|
Sets are used to store multiple items in a single variable.
|
|
|
|
Set is one of 4 built-in data types in Python used to store collections of data, the other 3 are List, Tuple, and Dictionary, all with different qualities and usage.
|
|
|
|
A set is a collection which is unordered, unchangeable*, and unindexed.
|
|
|
|
*Note: Set items are unchangeable, but you can remove items and add new items.
|
|
|
|
Sets are written with curly brackets.
|
|
Example:
|
|
|
|
#+begin_src python
|
|
# Create a Set:
|
|
thisset = {"apple", "banana", "cherry"}
|
|
print(thisset)
|
|
#+end_src
|