Python | sympy.is_zero() method
Last Updated :
08 Feb, 2023
In the sympy module, we can test whether a given number n is zero or not using sympy.is_zero() function.
Syntax: sympy.is_zero(n)
Parameter: n; number to be tested
Return: bool value result
Code #1:
Python3
from sympy import *
geek1 = simplify( 1 ).is_zero
geek2 = simplify( 0 ).is_zero
print (geek1)
print (geek2)
|
Output:
False
True
Code #2:
Python3
from sympy import *
geek1 = simplify( 0.0 ).is_zero
geek2 = simplify( 2 ).is_zero
print (geek1)
print (geek2)
|
Output:
True
False
Share your thoughts in the comments
Please Login to comment...