Interview question
What is a docstring and why is it important? Docstring क्या है और महत्वपूर्ण क्यों है?
Answer
def add(a, b):
'''Add two numbers.
Args:
a: First number
b: Second number
Returns:
Sum of a and b
'''
return a + b
# Access docstring
print(add.__doc__)
help(add)def func():
'''Function description.
Args, Returns, Examples
'''
pass
help(func) # Docstring show करता हैWas this answer clear?