User defined function and docstring in python

 User-defined function and docstring in python


def function1(): #defining function
print("this is function 1")

def function2(a,b,c): #defining function with arguments
print("addition of a, b, c is ",a+b+c)

def function3(a,b): #defining function with argument and returning value
return a+b
def function4():
"""this method prints a message this is a docstring"""
print("hello namastey")

function1() #calling function1
function2(10,20,30) #calling function2
x=function3(69,96) #calling function3
print("returned value from function3 ",x)
print(function4.__doc__) #prints docstring of function4

Comments