Defining a Function

def
Β 
keywordΒ 
isΒ 
usedΒ 
toΒ 
createΒ 
aΒ 
functionΒ 
inΒ 
python.
WeΒ 
defineΒ 
aΒ 
functionΒ 
byΒ 
writing
Β 
defΒ 
followedΒ 
byΒ 
theΒ 
function
Β 
name
,Β 
theΒ 
roundΒ 
()
Β 
brackets,Β 
andΒ 
colon
Β 
":"
.
TheΒ 
functionΒ 
bodyΒ 
thenΒ 
functionsΒ 
bodyΒ 
comesΒ 
underΒ 
theΒ 
defΒ 
block.Β 
ItΒ 
needsΒ 
toΒ 
beΒ 
indented
(4Β 
spacesΒ 
orΒ 
aΒ 
tab).
def function_name():
    <function body>
def add():
    a=1
    b=2
    print(a+b)
add()
#calling the function