python中输入a,b,c三个整数,找出最小的数
时间: 2023-05-11 17:04:47 浏览: 2779
可以使用Python内置的min()函数来找出最小的数,代码如下:
a = int(input("请输入第一个整数:"))
b = int(input("请输入第二个整数:"))
c = int(input("请输入第三个整数:"))
min_num = min(a, b, c)
print("最小的数是:", min_num)
相关问题
用Python通过比较找出三个整数中的最大数
可以使用Python内置的max函数来找出三个整数中的最大数,示例代码如下:
a = 10
b = 20
c = 30
max_num = max(a, b, c)
print("三个整数中的最大数为:", max_num)
输出结果为:三个整数中的最大数为: 30
从键盘输入三个整数,找出其中最小的数并输入到屏幕上
示例代码:
```python
a = int(input("请输入第一个整数:"))
b = int(input("请输入第二个整数:"))
c = int(input("请输入第三个整数:"))
min_num = a # 先将第一个数设为最小值
if b < min_num:
min_num = b
if c < min_num:
min_num = c
print("最小的数是:", min_num)
```
运行结果:
```
请输入第一个整数:5
请输入第二个整数:3
请输入第三个整数:8
最小的数是: 3
```
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)