Home >>Python math Module >Python math.isqrt() Method

Python math.isqrt() Method

Python math.isqrt() Method

Python math.isqrt() method is used to round a square root number downwards to the nearest integer. The given input number must be greater than or equal to 0.

Syntax:
math.isqrt(x)

Parameter Values

Parameter Description
x This is a required parameter. It defines a number to round the square root of.
Here is an example of Python math.isqrt() method:

import math
# The square root of different numbers
print (math.sqrt(10))
print (math.sqrt (12))
print (math.sqrt (68))
print (math.sqrt (100))
# Round square root to the nearest integer
print (math.isqrt(10))
print (math.isqrt (12))
print (math.isqrt (68))
print (math.isqrt (100))

Output:
3.1622776601683795
3.4641016151377544
8.246211251235321
10.0
3
3
8
10

No Sidebar ads