Nishu

nishumsn03@gmail.com

What is DocString???

Posted on February 19, 2021



Docstring is a convenient way to identify that what is executing in a function. It is a type of comment which we can write within a function.That comment write within """ ("""example""").The syntax of Docsting is .__doc__ .

Example-

def function1(a,b):

"""This is a function used for calculating the average of two numbers."""

average= (a+b)/2

#print(average)

function1(5, 6)

print(function1.__doc__)

#Output

This is a function which is calculating the average of two numbers.


Sign In for comment and like the post.