6/30/22

Python Function

 Function is a collection of operations which can be easily accessed throughout a program. these operation accepts a variable and passes it through the stated operations to give an output.


Take functions in mathematics.

If we have a function, f(x)=2x2

x is usually derived from a table, graph, etc, and is passed into the function as x to get f(x).

This is the exact same in python.

Declaring a function.


Given the function above, functionName(var), if you wish to access it in a program you simple declare it with it value i.e




|

Blog Archive