比较大小python代码
时间: 2023-09-10 13:11:18 浏览: 72
以下是一个比较大小的Python代码示例:
```python
a = 5
b = 10
if a > b:
print("a is greater than b")
elif a == b:
print("a and b are equal")
else:
print("b is greater than a")
```
上述代码将输出“b is greater than a”,因为变量b的值大于变量a的值。如果将a和b的值更改,则输出可能会发生变化。
阅读全文