I have this simple line of code:
i = " "
if i != "" or i != " ":
print("Something")
This should be simple, if i is not empty "" OR it's not a space " ", but it is, print Something. Now, why I see Something printed if one of those 2 conditions is False?
De Morgan's laws,
In your case, as per the first statement, you have effectively written
which is not possible to occur. So whatever may be the input,
(i == "" and i == " ")will always returnFalseand negating it will giveTruealways.Instead, you should have written it like this
or as per the quoted second statement from the De Morgan's law,