1. What is a Function?

# define the function
def my_function(x, y, z=1.5):
  if z > 1:
    return z * (x + y)
  else:
    return z / (x + y)
# execute the function
my_function(1, 2, 3)
## 9
my_function(1, 2)
## 4.5
# define the function
def function_without_argument():
  print('I\'m still a function!')
# execute the function
function_without_argument()
## I'm still a function!

1.1 Definining a function vs. a function call?

# define the function
def my_function(x, y, z=1.5):
  if z > 1:
    return z * (x + y)
  else:
    return z / (x + y)

# execute the function
my_function(1, 2, 3)
## 9

# execute the function
my_function(1, 2, 0.5)
## 0.16666666666666666