Functions and Algorithms
While functions denote a specific object in Python programming with which we can order and factor our programs, the term algorithm typically refers to the general organization of a sequence of logic to process its given input data. In data science and scientific computing, algorithms are ubiquitous, commonly taking the form of machine learning models that are used to process data and potentially make predictions.
In this section, we will discuss the concept and syntax of Python functions and then tackle some example algorithm-design problems.
Functions
In its most abstract definition, a function is simply an object that can take in an input and producing an output, according to a given set of instructions. A Python function is of the following form:
def func_name(param1, param2, ...):     […]     return […]
The def
keyword denotes the start of a Python function. The name of a function can...