At the core of programming languages is the idea of functions.
However, languages tend to treat them differently.
In most programming languages, the attitute towards a function is as a way of encapsulating code. They take some parameters, execute code and return data and that's it.
However, python as well as many modern languages do take the notion of function much more than just a code capsule. They treat functions as full objects. As objects they can be passed around, wrapped in other functions or replaced by new implementations.
In short functions are also types.
function type forms the basis of functions in Python.
In fact we can check the type of a given function using the
def greet(): print('Hello') print(type(greet))
Functions always can take arguments. And this is one of the secrets of their power. However, python takes this power to the next level in that it allows us pas keyword arguments and even arguments that won't be know until runtime when the function is invoked.
For example, the following simple example allows us specify an argument that will only be entered at runtime.
def greet(name): return 'Hello ' + name name=input("Enter You Name to receive a Greeter: ") print(greet(name))
Enter You Name to receive a Greeter: Oclemy Hello Oclemy