I am trying to make what I thought would be a simple if statement. It goes as follows:
if (Main.longest_word is None) | (len(Main.longest_word) < len(word)):
Main.longest_word = word
My issue is that I keep getting TypeError: object of type 'NoneType' has no len()
This makes sense to me, and I have solved the issue by simply turning my original if statement into two separate if statements.
My question is: Is there a way to make this if statement works as one, or am I forced to make two separate if statements in this situation.
Thanks for any advice.
Aucun commentaire:
Enregistrer un commentaire