
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 - Functions
Functions are blocks of code with a defined task. They allow better organisation, avoid repetition and provide better readability.
def function_name(param1, param2):
# code to execute
return value
function_name(arg1, arg2)
Parameters / arguments and return
- parameters: variables that are passed to the function, they are defined in the declaration of the function.
- arguments: values that are passed when calling the function.
- return: the result sent back by the function after its execution, if not defined the function will return
Noneby default.
def addition(a, b):
return a + b
result = addition(3, 5)
Variables reach (scope)
The scope of a variable determines where it can be used, variables defined inside a function have a local scope, they can be accessed only inside this function.
Local scope
def my_function():
x = 10 # local variable
print(x)
my_function() # Displays 10
print(x) # Error: x is undefined
Global scope
x = 10 # global variable
def my_function():
global x # mark that we want to use and edit the global variable
x = 20
print(x)
my_function() # Displays 20
print(x) # Displays 20 too because the global variable was edited
Default values for parameters
If you define a default value for a parameter and no argument is used when calling this function, the default value will be used instead.
def hello(word="world")
print(f"Hello {word}!")
hello("Joe") # "Hello Joe!"
hello() # "Hello world!"