vendredi 6 novembre 2015

PY IDLE Flagging up error I don't understand

Python Idle is flagging up an error in my code, in the line:
if pos[1] != 6: tbd.append(pushPos(pos[0],pos[1]+1,0)
highlighting the colon after the 6 ands saying there is a syntax error.

The function as a whole that it is in, in case you need it, is:

def clearPDoms(group,store):
    for i in store:
        removed.append(i[1])
    for i in removed:
        pos = getPos(i)
        tbd = [pushPos(pos)]
        ntbd = 1
        if pos[2]==0:
            if pos[1] != 0:
                tbd.append(pushPos(pos[0],pos[1]-1,0)
            if pos[1] != 6:
                tbd.append(pushPos(pos[0],pos[1]+1,0)
            if pos[0] != 0:
                tbd.append(pushPos(pos[0]-1,pos[1],1))
                tbd.append(pushPos(pos[0]-1,pos[1]+1,1))
            if pos[0] != 6:
                tbd.append(pushPos(pos[0]+1,pos[1],1))
                tbd.append(pushPos(pos[0]+1,pos[1]+1,1))
        else:
            if pos[0] != 0:
                tbd.append(pushPos(pos[0]-1,pos[1],1)
            if pos[0] != 5:
                tbd.append(pushPos(pos[0]+1,pos[1],1)
            if pos[1] != 0:
                tbd.append(pushPos(pos[0],pos[1]-1,0))
                tbd.append(pushPos(pos[0]+1,pos[1]-1,0))
            if pos[1] != 7:
                tbd.append(pushPos(pos[0],pos[1]+1,0))
                tbd.append(pushPos(pos[0]+1,pos[1]+1,0))
    for i in tbd:
        for j in range(0,len(group)-1):
            if check(i,group[j][1]) == True:
                del group[j]  

Many thanks for your help.

Aucun commentaire:

Enregistrer un commentaire