📜  Python| sympy.is_zero() 方法

📅  最后修改于: 2022-05-13 01:54:47.602000             🧑  作者: Mango

Python| sympy.is_zero() 方法

在 simpy 模块中,我们可以使用 sympy.is_zero()函数测试给定数字 n 是否为零。

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

代码#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)


Python3
# Python program to check zero number
# using sympy.is_zero() method
 
# importing sympy module
from sympy import *
 
# calling is_zero function on different numbers
geek = simplify(002).is_zero
 
print(geek)


输出:

False
True

代码#2:

Python3

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

输出:

False