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 modulefrom sympy import *# calling is_nonpositive function on different numbersgeek1 = simplify(-21).is_nonpositivegeek2 = simplify(0).is_nonpositiveprint(geek1)print(geek2) |
Output:
True False
Code #2:
Python3
# Python program to check non-positive number # using sympy.is_nonpositive() method# importing sympy modulefrom sympy import *# calling is_nonpositive function on different numbersgeek = simplify(-002).is_nonpositiveprint(geek) |
Output:
True
