
CAUTION
Some files are private or not ready yet, if a link gives you a 404 that's why :)
This is a work in progress, new notes will be added daily
List of note Indexes
๐ PROJECTS๐ ART๐ TECHNOLOGY๐ SCIENCE๐ PHILO-PSYCHO๐ HISTORY๐ HEALTH๐ GAMING๐ KNOWLEDGE
.... |\| .|||. |\/| .|\\. .|.
.\\||/|. .\|..|| .\|..|||...||.....
.| .....||.|\\\\\\ ... |\\\/. .\\. .||
.\\| .|\\|..|\\ .\\\\ .\\|. .\\\\\| |\| |\\|
|\\ |\\|.. /\\\. |\|\\ \\\\|. .|\\. .\\\\|
.\\. |\\\\\\\|.. .\\| .\\||\\/|. |\\| .|/\|
\. .\\\||/\|.... \\| |\/ |\\\ |\\\| .\\| \\| ....
|\/ |\\| |\\\\\\\| |\|.\\\ \\\\. |\\\\| |\\ \\. ||..
..|||\| .. .\\\\. |\\\\\\ .\\|....|\\\. |\\\\\\ |/. |/
\\\|.. .\\\ |\\. .\\\| \\| |||\\\. ...|\\/||. .\\\
|\| |\/. /\\\\\| .\\\\. \\. .../|. .|\\\|. |\\\| |\\
. |||\\|. ..||| .\\|. |\| \\|..../\\| |\\| .\\\\\ ..
\\| .||\|.|.. |\\\|./\ \\||\. ||... .\\\\/. |\/||
..|/||. |\\\\\|. .|/\| ||. .||\\\ .|||. |\
.\/| \\\. .|\\\|||\\\||.. .|\\\\\\\|\\\\. /\\\\||. |
.|| |\\\\| .......|\\\\\\. .\\\. ..|||.... .\\\\|.. ...
\\||....|\\\\\\\\||\\\\\\\/ |\|....|||\\\\\\\/....|\\\|
||.|\||\\| .....|\\\\..\\| .|\\\. ||........ .|\|...
. |\ /\\/\\\\\\. |\. .\\\\\\. ./\\\\/ |\\\||.
.|\.|\| .|\|... .. ./\\|..|\\| ..
.|\\| .\\\\.\\\\\\\ \||...\\\|..|\\\|.||
|\. ..||....|| ... ..||\\\. .|.
... .......
โ Python
Python - Tuples
A tuple is an immutable sorted collection of values. You cannot change the length of a tuple after its creation nor edit its values. a tuple is defined using parenthesis.
[!TIP] Tuples are memory efficient
my_tuple = (1, 2, 3.5, "a", "b")
def returnsMultipleValues():
return 1,2,3
type(returnsMultipleValues()) # tuple
Indexing
Similar to Array indexing
my_tuple = (1, 2, 3, 4, 5)
first_value = my_tuple[0] # 1
last_value = my_tuple[-1] # 5
Slicing
Similar to Array slicing
my_tuple = (1, 2, 3, 4, 5)
my_tuple[1:2] # (2, 3)
Sorting
Since tuple are immutable you cannot sort them directly, you need to use sorted(<tuple>, <key - optional>) which produce an array and then convert it to a tuple using tuple()
my_tuple = (5, 2, 1, 3, 4)
tuple(sorted(my_tuple)) # (1, 2, 3, 4, 5)
# Sort using keys
my_tuple = ({'x': 1, 'y': 2}, {'x': 3, 'y': 2}, {'x': 3, 'y': 1}, {'x': 2, 'y': 4})
sorted(my_tuple, key= lambda x: (x['x'], x['y']))
Nesting
my_nested_tuple = (1, (2, 3), (4, (5, 6)))
Indexing nested values
my_nested_tuple = (1, (2, 3), (4, (5, 6)))
my_nested_tuple[2][1][0] # 5
Unpack
my_tuple = (1,2,3)
a, b, c = my_tuple