Thursday, October 16, 2025
HomeLanguagesPython | sympy.is_zero() method

Python | sympy.is_zero() method

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




# Python program to check zero
# using sympy.is_zero() method
 
# importing sympy module
from sympy import *
 
# calling is_zero function on different numbers
geek1 = simplify(1).is_zero
geek2 = simplify(0).is_zero
 
print(geek1)
print(geek2)


Output:  

False
True

Code #2: 

Python3




# Python program to check negative number
# using sympy.is_negative() method
 
# importing sympy module
from sympy import *
 
# calling is_negative function on different numbers
geek1 = simplify(0.0).is_zero
geek2 = simplify(2).is_zero
 
 
print(geek1)
print(geek2)


Output: 

True
False
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32361 POSTS0 COMMENTS
Milvus
88 POSTS0 COMMENTS
Nango Kala
6728 POSTS0 COMMENTS
Nicole Veronica
11892 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11953 POSTS0 COMMENTS
Shaida Kate Naidoo
6852 POSTS0 COMMENTS
Ted Musemwa
7113 POSTS0 COMMENTS
Thapelo Manthata
6805 POSTS0 COMMENTS
Umr Jansen
6801 POSTS0 COMMENTS