1def myFunction(say): #you can add variables to the function
2 print(say)
3
4myFunction("Hello")
5
6age = input("How old are you?")
7
8myFunction("You are {} years old!".format(age))
9
10#this is what you get:
11
12Hello
13How old are you?
14>>11 #lol my real age actually
15You are 11 years old!
1#A function is a block of code which only runs when it is called.
2#You can pass data, known as parameters, into a function.
3#folling is a simple function
4def exmple_of_function():
5 print("Hello from a function")
6
7example_of_function()
1def name():#name of the def(function);
2 print("Hallo, World!")#Output is Hallo, World!;
3
4name()#Name of the def, the programm will jump to the def;
5
6#output:
7#Hallo, World!
1# Defines Function
2def my_function():
3 print("Hello")
4 print("Bye")
5
6# Calls Function
7my_function()