Tuesday, June 9, 2026
HomeLanguagesPython | sympy.is_negative() method

Python | sympy.is_negative() method

In sympy module, we can test whether a given number n is negative or not using sympy.is_negative() function. 

Syntax:  sympy.is_negative(n)
Parameter:  n; number to be tested
Return:  bool value result 

Code #1: 

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(-21).is_negative
geek2 = simplify(0).is_negative
 
print(geek1)
print(geek2)


Output:  

True
False

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.2).is_negative
geek2 = simplify(2).is_negative
 
 
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
32515 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6895 POSTS0 COMMENTS
Nicole Veronica
12012 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12109 POSTS0 COMMENTS
Shaida Kate Naidoo
7018 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6976 POSTS0 COMMENTS
Umr Jansen
6963 POSTS0 COMMENTS