2.3 More About the math Module

Many mathematical helper functions are available in the math module. How do we know which methods or functions are available? Fortunately, Python has a built-in help subsystem that allows you to see the documentation for a particular module or function. To use this help, simply give the command help("modulename"), where the module name is the module you are interested in. Alternatively, if you know the name of a function and you want to know how to call that function, you can use the command help("modulename.functionname"). For example, Session 2.1 shows the result of asking for help on the math module. You might find it interesting that in addition to typical math functions, the math module contains several data constants, including pi.

Some of the notations shown in SESSION 2.2, such as “/”, are beyond what we have covered so far. We will explain these notations later.

Image

SESSION 2.2 Asking for help on a Python module

In the sections that follow, we explore several interesting techniques for approximating pi. Remember that none of these techniques can give us an exact answer.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.30.236