jeudi 13 mai 2021

Variable Wrongly Passes Through Elif Statement (Python 3) [duplicate]

thing = 'window'

if 'table' or 'chair' in thing.lower().split():
        print('AHHHHHH I HATE THIS SO MUCH')

For some reason the statement is printed, even though 'table' or 'chair' are clearly not in the variable. Why does this happen?

Aucun commentaire:

Enregistrer un commentaire