mardi 5 septembre 2017

Python conditional evaluation

I expect below code to work properly, since first condition if false, but it throughs IndexError: string index out of range. What am I missing?

 a = False
 sample_strign = 'test'
 if (a == True) & (sample_strign[7] == 's'):
        print('foo')

Aucun commentaire:

Enregistrer un commentaire