As previously explained, functions are mathematical objects that generally take in some input and produce a desired output. A function is therefore often considered as a mapping of one mathematical object to another. When a function receives an input and subsequently produces an output, the concept of relation can also be used, which emphasizes the relationship between the set of possible inputs and that of possible outputs that is established by the function itself.
A function is typically denoted by the lowercase letter f with parentheses, which surround an input that f takes in. This symbol, f(x), also denotes the output that f produces when taking in x as input. For example, let's say the function f that outputs the square of its input; f can be denoted as f(x) = x2.
We see that the syntax for declaring a function in Python also follows this convention. For example, to declare the same squaring function in Python, the code would look like the following:...