【发布时间】:2026-01-19 20:45:01
【问题描述】:
我想将变量 'average' 添加到名为 avgList 的列表中,但我收到错误消息 'NoneType' object has no attribute 'append'
tempList = []
nameList = []
avgList = []
ctr = 0
ctrr = 0
while ctrr <12:
name = raw_input("Enter team name: ")
ctrr += 1
ctr = 0
while ctr <8:
score = input("Enter Scores: ")
ctr += 1
tempList.append(score)
summ = sum(tempList)
average = summ/len(tempList)
avgList = avgList.append(int(average))
print max(avgList)
【问题讨论】:
标签: python list append nonetype