How to import math library in Python and call its functions ?

In this post, we will look how to use a library in python and call its various functions.

For example:- we can import all functions provided by math library using “import *” command.

Program

from math import *

num1=3.7
print(floor(5.89))
print(ceil(5.87))
print(sqrt(49))

 

Output

5
6
7.0

 

Explanation:
1. floor(5.89) returns 5 i.e.e rounded off to a less digit i.e. 5.
2. ceil(5.87) returns the rounded off greater digit i.e. 6.
3. sqrt(49) returns square root of 49 i.e. 7.

Leave a Reply

Your email address will not be published.