list - 初学python,出现错误,但是不知道如何修改
怪我咯
怪我咯 2017-04-18 10:05:36
0
2
1554
           初学python,出现错误,但是不知道如何修改

错误提示是
Traceback:
in
in openOrSenior
AttributeError: 'list' object attribute 'append' is read-only

def openOrSenior(data):
    # Hmmm.. Where to start?
    long=len(data)
    result=[]
    for i in range(long):
        if (data[i][0]>=55) and (data[i][1]>7):
            result.append=("Senior")
        else:
            result.append=("Open")
          
    return result
怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(2)
小葫芦

result.append('Senior'), no equal sign required

刘奇

There is an extra equal sign after result.append

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template