首页 > 解决方案 > 为什么我的 Python 代码会这样打印?

问题描述

我输入了传递的 int 值并尝试对其进行布尔运算,但我无法理解为什么它会给出这种输出。

x = int(input())
y = int(input())
print(x and y)
print(x or y)

上述代码的输出:

12
13

13
12

标签: pythonlogical-operators

解决方案


推荐阅读