It's a question at the crossroads between computing and set theory
I just immersed myself in the Python documentation to answer this question
Let say $w$ is a string. What is the difference between the following two tests:
w.isupper ()andnot w.islower ()
For me, the difference is that, in mathematical terms, w.isupper () means
$$∀x ∈ w, x∈ Upper$$
not w.islower () means
$$∃ x ∈ w, x ∉ Lower$$
I do not know if it is enough for everyone to say that it is different, it is Set theory and, sometimes, I really need time to understand it. Also, there may be other computational or python reasons that I do not know
This question is from chapter 1 of Natural Language Processing with Python
Assuming
wis a string (or a byte array or something similar), the docs say following:And
So
w.isupper()checks whether all characters are in uppercase, whilew.islowerchecks whether all characters are in lowercase. Thereforenot w.islower()checks whether there is at least one uppercase character.This is exactly what you've guessed in your post.