Fnctions and Liberaries
Fnctions and Liberaries
Introduction
• A book is generally divided into chapters. Why?
• Similarly, a big program is generally divided into small units, which are
known as modules.
Importing module.
▪ Eg : print(math.sqrt(144))
Built-in Modules
▪Python library has many built-in modules that are easy to use for
the programmers. Some commonly used modules and the
frequently used functions that are found in those modules are
listed below:
⮚ math
⮚ random
⮚ statistics
Math Module
32
Example 2.
>>> from math import ceil, sqrt
>>> value = ceil(624.7) #Function called without the module name
>>> sqrt(value)
Output:
25.0