Write a python script to print the docstring(documentation string) of the input function.

0 votes
asked Jul 6 by Andres Forero (120 points)

def input():
‘’‘this is doc string’’’
return None

what is my mistake?

3 Answers

0 votes
answered Jul 8 by Peter Minarik (7,160 points)

I'm not exactly sure what you're after.

If you want your function to return a value, you do not return None, but an actual value, which you can use later.

def input():
    return "Hello"

0 votes
answered Jul 8 by MrStaceyMoore (140 points)
Use .__doc__ to access the doc string of a function in python.

def func():
    hello world
0 votes
answered Jul 8 by xDELLx (2,430 points)

‘’‘this is doc string’’’ to be changed to """this is doc string """

Note : use double quotes & not single quote.

print(input.doc)  to be changed to print input.__doc__

Please refer the documentation.



Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.