Functions
A function is a rule for taking zero or more inputs and returning a corresponding output. In Python, we typically define functions using def:
def double(x): """this is where you put an optional docstring that explains what the function does. for example, this function multiplies its input by 2""" return x * 2
Leave a Reply