Definition of Function

Function
FunctionsΒ 
areΒ 
mini-programs
Β 
orΒ 
aΒ 
blockΒ 
ofΒ 
codeΒ 
thatΒ 
areΒ 
reusable
Β 
anywhereΒ 
inΒ 
yourΒ 
program.Β 
AΒ 
functionΒ 
performsΒ 
aΒ 
task,Β 
andΒ 
onceΒ 
itΒ 
isΒ 
definedΒ 
weΒ 
canΒ 
performΒ 
theΒ 
taskΒ 
byΒ 
calling
Β 
theΒ 
functionΒ 
usingΒ 
theΒ 
functionΒ 
name.

In-Built Functions

PythonΒ 
hasΒ 
aΒ 
setΒ 
ofΒ 
in-built
Β 
functionsΒ 
thatΒ 
areΒ 
alreadyΒ 
definedΒ 
toΒ 
performΒ 
aΒ 
certainΒ 
task.
TheΒ 
pythonΒ 
interpreterΒ 
hasΒ 
severalΒ 
functionsΒ 
thatΒ 
areΒ 
alwaysΒ 
presentΒ 
forΒ 
use.
Eg.
Β 
print()
,Β 
min()
,Β 
max()
,Β 
len()
,Β 
etc.

User Defined Functions

PythonΒ 
allowsΒ 
usΒ 
toΒ 
defineΒ 
andΒ 
useΒ 
ourΒ 
ownΒ 
customΒ 
logicΒ 
insideΒ 
aΒ 
function.
FunctionsΒ 
thatΒ 
weΒ 
defineΒ 
ourselvesΒ 
toΒ 
doΒ 
certainΒ 
specificΒ 
tasksΒ 
areΒ 
referredΒ 
toΒ 
asΒ 
user-defined
Β 
functions.

Calling a Function

Calling
Β 
(Using)Β 
aΒ 
functionΒ 
isΒ 
doneΒ 
inΒ 
aΒ 
particularΒ 
wayΒ 
inΒ 
Python.
WeΒ 
justΒ 
writeΒ 
theΒ 
nameΒ 
ofΒ 
theΒ 
functionΒ 
followedΒ 
byΒ 
roundΒ 
()
Β 
bracketsΒ 
containingΒ 
theΒ 
arguments
.
function_name(arguments)
word = 'apple'
print(len(word))
#Here len() function has the argument 'apple', and print() function has the argument as len()