initial
This commit is contained in:
22
20250804214537-python_set.org~
Normal file
22
20250804214537-python_set.org~
Normal file
@@ -0,0 +1,22 @@
|
||||
: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
|
||||
Reference in New Issue
Block a user