Defining simple function

def add(x, y):
    z = x + y
    return z

a = add(2, 3)
print(a)    # 5

q = add(23, 19)
print(q)   # 42
The function definition starts with the word "dev" followed by the name of the function ("add" in our example), followed by the list of parameters in a pair of parentheses, followed by a colon ":". Then the body of the function is indented to the right. The depth of indentation does not matter but it must be the same for all the lines of the function. When we stop the indentation and start a new expression on the first column, that's what tells Python that the function defintion has ended.