博文

Sololearn Python 闯关解答 (Floats)

图片
Which of these will not be stored as a float? 答案为 7 因为7 是整数 (int) Fill in the blank with the output of this code. >>> 1 + 2 + 3 + 4.0 + 5 答案为 15.0 因为与 浮点数 4.0 相加, 所以结果为浮点数 15.0

Sololearn Python 闯关解答 (Simple Operations)

图片
Simple Operation s 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 不能作为除数。