mercredi 3 juin 2015

Proper if..else syntax in Python

In my python code, I am attempting to implement an if..else statement. See below:

     if index[y] == index[x]:
            continue
            else index[y] != index[x]
                indexdn = indexd
                indadd= index[y]-index[x]
                indexdn[:,y]=indexdn[:,y]+ indadd
                index[y,:]=-indexdn[:,y]
                indexdn[y,y]=0

However, no matter how many different ways I attempt to write else index[x] is not equal to index[y] I get a syntax error on return of this line. I have tried using else, elif, and for the not operand, != and 'is not'. What is the proper way to write a Python statement using a "not equal" operand so that I do not receive a syntax error?

Aucun commentaire:

Enregistrer un commentaire