Course Content

If you are facing any issue in playing video please use Firefox browser.

Course Content

Description

How to use Inbuilt Module in Python

 

math Module

 

The math module is a standard module in Python and is always available. To use mathematical functions under this module, you have to import the module using import math.

 

ceil(x) : returns the smallest integer greater than or equal to x.

floor(x) : returns the largest integer less than or equal to x.

log10(x) : returns the base 10 logarithm of x.

pow(x, y) : returns x raised to the power y.

sqrt(x) : returns the square root of x.

Pi : Mathematical constant, the ratio of circumference of a circle to it's diameter. (3.14159...)

E : Mathematical constant e (2.71828...)

 

random Module

 

Python random module that can generate random numbers.

 

randrange(start,stop,[step]) - returns a random integer from the range.

randint(a,b) - Returns a random integer between a and b inclusive.

random() - return the next random floating point number in the range [0.0,1.0]

 

Example :

import math

x=55.42

print(math.ceil(x))

print(math.floor(x))

print(math.pow(5,3))

O/P -

56

55

125.0

FAQs

Share With Friend

Have a friend to whom you would want to share this course?

Download The Apps

Code Scan or Download the app
Google Play Store
297K+ Downloads
4.5 Rating
10K+ Reviews
  • Learn anywhere on the go
  • Get regular updates about your enrolled or new courses
  • Share content with your friends
  • Evaluate your progress through practice tests
  • No internet connection needed
  • Enroll for the webinar and join at the time of the webinar from anywhere