如何判断整数小数点后是否为零
a = 17.3678
if a???:
print("the value after the decimal point is zero")
else:
print("the value after the decimal point is not zero")
最佳答案
可以使用split方法:
a = 17.3678
a = str(a)
valueAfterPoint = a.split('.')[1]
valueAfterPoint = int(valueAfterPoint)
if valueAfterPoint == 0:
print("the value after the decimal point is zero")
else:
print("the value after the decimal point is not zero")
关于python - 如何检查整数小数点后的值是否为零,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71372380/