一行中输入两个数字字符串,两个数字字符串以空格间隔,输出两个数字字符中最大的数字字符。
时间: 2023-04-29 18:01:14 浏览: 119
可以先将两个数字字符串转换成整数,然后比较大小,输出较大的数字字符即可。具体实现可以使用以下代码:
```python
s = input() # 输入两个数字字符串,以空格间隔
a, b = s.split() # 将字符串分割成两个数字字符串
if int(a) > int(b):
print(a)
else:
print(b)
```
例如,输入"123 456",输出"456"。
阅读全文
相关推荐
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![text/plain](https://img-home.csdnimg.cn/images/20250102104920.png)
![doc](https://img-home.csdnimg.cn/images/20241231044833.png)