import random
max_list = []
ord_list = []
for i in range(1, 101):
a = random.randint(1, 100)
ord_list = ord_list.append(a)
max_value = max(ord_list)
if max_value > max(max_list):
max_list = max_list.append(max_value)
print(f"{max_value}----updated")
else:
max_list = max_list.append(max_value)
print(max_value)
maxmax = max(max_list)
counting = max_list.count(maxmax)
print(max_list)
print(f"the biggest value is {maxmax} and showed up {counting} times")
运行报错:
line 7, in
max_value = max(ord_list)
TypeError: 'NoneType' object is not iterable
奇怪,到底哪里有问题?