You are on page 1of 10

Full stack web development using python

functions

Saurabh Shukla (MySirG)


- Agendas
① Function Introduction
② Defining function

③ Function call us definition


function

④ Ways to define a function


Function

Function is a block of code which

when it is called
only runs .

Function has a name for identification


keyword
FUnctionDefinitionde.tt

function Name (
args) :
code
code
Function call vs function Definition

def FIC ) :

Function number"D
"

a=int( input ( Enter a



Definition b. =- a * * 2
" "
ails b) "

print [ square of , ,

f- 1¢ ) function is
Function call -7 once

defined it can be
→ f- I C) ,

→ 71 ( I called any number


times
of
Waystodefineafuncticm
① Takes
Nothing ,
Returns Nothing
② Take Something ,
ReturnsNothing
③ Takes Nothing ,
Return Something
④ Take
something .
Return Something
TakesNIing.IE?ingdetaddcETN "

print (
"
Enter two numbers )

a= int ( input (7)


b. = int ( input C) )
C = a + b
"

print (
"
sum is , c)

add # N
Takes-meth-ing.IE?iny
def add # Formal
ca , b
Arguments
C = a + b
"

print (
"
sum is , c)

add C 10 ,
20

F-
Actual
)

Arguments
TIMING Returnʰg ,

def add C) :
"

print (
"
Enter two numbers )

a= int ( input (7)


b. = int ( input C) )
C = a + b

return C

S= add C)
)
"

print ( sum
"
is ,
s
Takes-meth-ing.re.tw#eth-ing
def add ca , b ) :

C = a + b

return c

add C 10 ,
20 )

You might also like