***Welcome to ashrafedu.blogspot.com ***This website is maintained by ASHRAF***
***Use tabs for Content***

POSTS

    Standard Library functions

    Python, as well as most other programming languages, comes with a standard library of functions that have already been written( known as library functions ). Many of the functions in the standard library, however, are stored in files that are known as modules. These modules, which are copied to your computer when you install Python, help organize the standard library functions.

    In order to call a function that is stored in a module, you have to write an import statement at the top of your program. An import statement tells the interpreter the name of the module that contains the function.

    Ex:

    import math

    The math module contains various mathematical functions that work with floatingpoint numbers.

    Ø  The math Module

    The math module in the Python standard library contains several functions that are useful for performing mathematical operations. These functions typically accept one or more values as arguments, perform a mathematical operation using the arguments, and return the result.


    The math module also defines two variables, pi and e, which are assigned mathematical values for pi and e. These variables can be used in equations that require their values.

    Example:

    area = math.pi * radius**2