Python: Print the documents of Python built-in function(s)

Python Basic: Exercise-11 with Solution

Write a Python program to print the documents (syntax, description etc.) of Python built-in function(s).

Sample function: abs()

Python Docstring:

A docstring is a string literal that occurs as the first statement in a module, function, class, or method definition. Such a docstring becomes the __doc__ special attribute of that object.

All modules should normally have docstrings, and all functions and classes exported by a module should also have docstrings. Public methods (including the __init__ constructor) should also have docstrings.

Sample Solution:-

Python Code:


Sample Output:

Return the absolute value of the argument.


Flowchart: Print the documents of Python built-in function(s) .

Visualize Python code execution:

The following tool visualize what the computer is doing step-by-step as it executes the said program:

Python Code Editor:


Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a Python program that accepts an integer (n) and computes the value of n+nn+nnn.
Next: Write a Python program to print the calendar of a given month and year.

What is the difficulty level of this exercise?

Test your Python skills with w3resource's quiz

Python: Tips of the Day

List comprehension:

>>> m = [x ** 2 for x in range(5)]
>>> m
[0, 1, 4, 9, 16]