借助sympy.is_integer
方法,我們可以檢查天氣元素是否為整數,該方法是否會返回布爾值,即True或False。
用法:sympy.is_integer
返回:Return True if integer else False.
範例1:
在這個例子中,我們可以通過使用sympy.is_integer
方法,我們可以檢查整數值,它將返回一個布爾值。
# import sympy
from sympy import *
# Use sympy.is_integer method
gfg = simplify(2).is_integer
print(gfg)
輸出:
True
範例2:
# import sympy
from sympy import *
# Use sympy.is_integer method
gfg = simplify(5.5).is_integer
print(gfg)
輸出:
False
相關用法
- Python next()用法及代碼示例
- Python os.dup()用法及代碼示例
- Python set()用法及代碼示例
- Python Decimal max()用法及代碼示例
- Python PIL ImageOps.fit()用法及代碼示例
- Python os.rmdir()用法及代碼示例
- Python sympy.det()用法及代碼示例
- Python Decimal min()用法及代碼示例
- Python os.readlink()用法及代碼示例
- Python os.writev()用法及代碼示例
- Python os.readv()用法及代碼示例
- Python PIL RankFilter()用法及代碼示例
- Python os.rename()用法及代碼示例
- Python os.sendfile()用法及代碼示例
注:本文由純淨天空篩選整理自Jitender_1998大神的英文原創作品 Python | sympy.is_integer method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。