Thursday, September 4, 2025
HomeLanguagesPython | sympy.is_nonpositive() method

Python | sympy.is_nonpositive() method

In simpy module, we can test whether a given number n is non-positive or not using sympy.is_nonpositive() function

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

Code #1:  

Python3




# Python program to check non-positive number
# using sympy.is_nonpositive() method
 
# importing sympy module
from sympy import *
 
# calling is_nonpositive function on different numbers
geek1 = simplify(-21).is_nonpositive
geek2 = simplify(0).is_nonpositive
 
print(geek1)
print(geek2)


Output: 

True
False

Code #2:  

Python3




# Python program to check non-positive number
# using sympy.is_nonpositive() method
 
# importing sympy module
from sympy import *
 
# calling is_nonpositive function on different numbers
geek = simplify(-002).is_nonpositive
 
print(geek)


Output: 

True

 

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

Most Popular

Dominic
32261 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6626 POSTS0 COMMENTS
Nicole Veronica
11795 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11855 POSTS0 COMMENTS
Shaida Kate Naidoo
6747 POSTS0 COMMENTS
Ted Musemwa
7023 POSTS0 COMMENTS
Thapelo Manthata
6695 POSTS0 COMMENTS
Umr Jansen
6714 POSTS0 COMMENTS