Sololearn Python 闯关解答 (Simple Operations)
Simple Operations
Which option is output by this code?
>>> (4 + 8) / 2
答案: 6.0
在Python 的传统除法运算中,无论是浮点数(flaot)还是整数(int) 得到的结果都会带有小数。
如果想获得整数 请使用‘ // ’ 例如(10//3)= 3
Which option is output by this code?
>>> (4 + 8) / 2
答案: 6.0
在Python 的传统除法运算中,无论是浮点数(flaot)还是整数(int) 得到的结果都会带有小数。
如果想获得整数 请使用‘ // ’ 例如(10//3)= 3
Drag and drop the answer that will cause a ZeroDivisionError.
>>> (17 + 94) / (-5 +
)
答案为 5
ZeroDivisionError. 错误提示 意为0 不能做除数
在Python传统运算中 0 不能作为除数。
评论
发表评论