python求随机输入一组正整数,求最大值、最小值

python求随机输入一组正整数,求最大值、最小值

问题描述:

python求随机输入一组正整数,求最大值、最小值
用for循环和if语句

List=input().split()
m=int(List[0])
n=int(List[0])
for i in range(len(List)):
    if int(List[i])>m:
        m=int(List[i])
    if int(List[i])<n:
        n=int(List[i])
print('最大值:',m)
print('最小值:',n)


 觉得有用的话采纳一下哈