Page 245 - Computer Science Class 11 Without Functions
P. 245

For instance, following statements display the help on function sqrt() of math module:

             >>> import math
             >>> help(math.sqrt)
                 Help on built-in function sqrt in module math:
                 sqrt(x, /)
                     Return the square root of x.
            Similarly, we can invoke help on the entire math module as follows:

             >>>  help(math)
            As the math module comprises several functions and some data values like pi and e, the help on the math module
            includes help on all of these functions and runs into 285 lines. You may right-click on the highlighted link to see the
            details. Below, we reproduce the first and the last few lines of help on the math module:
            Help on built-in module math:
            NAME
                math

            DESCRIPTION
                This module provides access to the mathematical functions
                defined by the C standard.

            FUNCTIONS
                acos(x, /)
                    Return the arc cosine (measured in radians) of x.

                    The result is between 0 and pi.

                acosh(x, /)
                    Return the inverse hyperbolic cosine of x.

                asin(x, /)
                    Return the arc sine (measured in radians) of x.

                    The result is between -pi/2 and pi/2.
                …
                …
                …
            DATA
                e = 2.718281828459045
                inf = inf
                nan = nan
                pi = 3.141592653589793
                tau = 6.283185307179586


            FILE
                (built-in)
            Python allows us to import together all the functions and other objects (like classes and data)  contained in a module
            and then access them directly without referring to the module name, for example,
             >>> from math import *
             >>> pi
                 3.141592653589793
             >>> e
                 2.718281828459045
             >>> sqrt(25)  #outputs
                 5.0


                                                                                                      Modules    243
   240   241   242   243   244   245   246   247   248   249   250