这样的效果?
import random list1 = [] for i in range(10): x = random.randint(1, 100) list1.append(x) print(list1) print(max(list1)) # [94, 41, 46, 5, 78, 85, 93, 18, 52, 66] # 94
因为x是随机生成的数字,max函数需要传递一个可迭代对象进去,比如列表、元组等,所以报错了