题解 | 列表的最值运算
num = input() list1 = [] for i in num.split(' '): i = int(i) list1.append(i) print(max(list1)) print(min(list1)) # 列表推导式写法: list2 = [int(i) for i in num.split(' ')] print(max(list2)) print(min(list2))
num = input() list1 = [] for i in num.split(' '): i = int(i) list1.append(i) print(max(list1)) print(min(list1)) # 列表推导式写法: list2 = [int(i) for i in num.split(' ')] print(max(list2)) print(min(list2))
相关推荐