FUNCTIONS
FUNCTIONS
STD: SYBSCIT
DIV: B
ROLL No: 111
SUBJECT: PYTHON PROGRAMMING
COLLEGE: M.L.DAHANUKAR COLLEGE OF COMMERCE
FUNCTIONS
IN
PYTHON
FUNCTIONS
Input parameter is
The keyword placed within the
def parenthesis() and also
introduces a define parameter inside
function the parameter
definition
def
functionname(parameters):
“function_docstring”
function suite
return[expression]
The code block
within every
Return statement exits a
function starts
function block. And we can
with a colon(:).
also use return with no
argument
CALL A FUNCTION IN PYTHON
Eg:
def f1():
print(“Hello World”)
def f2(n=“ABC”):
print(“Hello”,n) Function Defination
def f3(n1,n2):
s=n1+n2
return s
f1()
name=input(“\n Enter your name:”)
f2(name)
f2() Function Call
print(“\n Enter 2 numbers:”)
x,y = input().split()
sum=f3(int(x),int(y))
print(“Sum=”,sum)
Math Function