Sololearn Python 闯关解答 (Other Numerical Operations)


What is the result of this code?
>>> 7%(5 // 2)

答案为 1

首先看 (5//2) 使用// 后,运算取整数结果为 2

然后 看 % 符号, 7 % 2 可看成 7 除以 2 取余数。

取得余数即为 1

评论

此博客中的热门博文

Sololearn Python 闯关解答 (Simple Operations)