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!
1def example(): #This defines it
2 print("Example.") #This is the defined commands
3
4example() #And this is the commands being run
1# first we have to write 'def'
2# then our function name followed by ()
3# and a ':' abd defining block of code
4
5def multiply(): # naming convention could be same as variable for functions
6 product = 10.5 * 4
7 return product
8
9
10product = multiply()
11print(product)
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!