What is the difference between the following two tests: w.isupper () and not w.islower ()?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












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 () and not 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







share|cite|improve this question

























    up vote
    0
    down vote

    favorite












    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 () and not 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







    share|cite|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      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 () and not 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







      share|cite|improve this question













      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 () and not 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









      share|cite|improve this question












      share|cite|improve this question




      share|cite|improve this question








      edited yesterday









      William Elliot

      5,0722414




      5,0722414









      asked 2 days ago









      Marine1

      798722




      798722




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote













          Assuming w is a string (or a byte array or something similar), the docs say following:




          str.isupper()



          Return true if all cased characters in the string are uppercase and there is at least one cased character, false otherwise.




          And




          str.islower()



          Return true if all cased characters in the string are lowercase and there is at least one cased character, false otherwise.




          So w.isupper() checks whether all characters are in uppercase, while w.islower checks whether all characters are in lowercase. Therefore not w.islower() checks whether there is at least one uppercase character.



          This is exactly what you've guessed in your post.






          share|cite|improve this answer





















          • Yes but what about w = a?b
            – Marine1
            2 days ago










          • What is a?b? Consider posting further questions as seperate posts.
            – flawr
            2 days ago










          • a?b It's a string, it's still the same question
            – Marine1
            2 days ago










          • @Marine1: a?b may be Python syntax for some string, but we're not Python experts enough to know which string that is ...
            – Henning Makholm
            2 days ago











          • @Marine1 if w = a?b and a?b is a string, then so is w, and the answer is also the same.
            – flawr
            2 days ago










          Your Answer




          StackExchange.ifUsing("editor", function ()
          return StackExchange.using("mathjaxEditing", function ()
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
          );
          );
          , "mathjax-editing");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "69"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          noCode: true, onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );








           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2871875%2fwhat-is-the-difference-between-the-following-two-tests-w-isupper-and-not-w-i%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote













          Assuming w is a string (or a byte array or something similar), the docs say following:




          str.isupper()



          Return true if all cased characters in the string are uppercase and there is at least one cased character, false otherwise.




          And




          str.islower()



          Return true if all cased characters in the string are lowercase and there is at least one cased character, false otherwise.




          So w.isupper() checks whether all characters are in uppercase, while w.islower checks whether all characters are in lowercase. Therefore not w.islower() checks whether there is at least one uppercase character.



          This is exactly what you've guessed in your post.






          share|cite|improve this answer





















          • Yes but what about w = a?b
            – Marine1
            2 days ago










          • What is a?b? Consider posting further questions as seperate posts.
            – flawr
            2 days ago










          • a?b It's a string, it's still the same question
            – Marine1
            2 days ago










          • @Marine1: a?b may be Python syntax for some string, but we're not Python experts enough to know which string that is ...
            – Henning Makholm
            2 days ago











          • @Marine1 if w = a?b and a?b is a string, then so is w, and the answer is also the same.
            – flawr
            2 days ago














          up vote
          1
          down vote













          Assuming w is a string (or a byte array or something similar), the docs say following:




          str.isupper()



          Return true if all cased characters in the string are uppercase and there is at least one cased character, false otherwise.




          And




          str.islower()



          Return true if all cased characters in the string are lowercase and there is at least one cased character, false otherwise.




          So w.isupper() checks whether all characters are in uppercase, while w.islower checks whether all characters are in lowercase. Therefore not w.islower() checks whether there is at least one uppercase character.



          This is exactly what you've guessed in your post.






          share|cite|improve this answer





















          • Yes but what about w = a?b
            – Marine1
            2 days ago










          • What is a?b? Consider posting further questions as seperate posts.
            – flawr
            2 days ago










          • a?b It's a string, it's still the same question
            – Marine1
            2 days ago










          • @Marine1: a?b may be Python syntax for some string, but we're not Python experts enough to know which string that is ...
            – Henning Makholm
            2 days ago











          • @Marine1 if w = a?b and a?b is a string, then so is w, and the answer is also the same.
            – flawr
            2 days ago












          up vote
          1
          down vote










          up vote
          1
          down vote









          Assuming w is a string (or a byte array or something similar), the docs say following:




          str.isupper()



          Return true if all cased characters in the string are uppercase and there is at least one cased character, false otherwise.




          And




          str.islower()



          Return true if all cased characters in the string are lowercase and there is at least one cased character, false otherwise.




          So w.isupper() checks whether all characters are in uppercase, while w.islower checks whether all characters are in lowercase. Therefore not w.islower() checks whether there is at least one uppercase character.



          This is exactly what you've guessed in your post.






          share|cite|improve this answer













          Assuming w is a string (or a byte array or something similar), the docs say following:




          str.isupper()



          Return true if all cased characters in the string are uppercase and there is at least one cased character, false otherwise.




          And




          str.islower()



          Return true if all cased characters in the string are lowercase and there is at least one cased character, false otherwise.




          So w.isupper() checks whether all characters are in uppercase, while w.islower checks whether all characters are in lowercase. Therefore not w.islower() checks whether there is at least one uppercase character.



          This is exactly what you've guessed in your post.







          share|cite|improve this answer













          share|cite|improve this answer



          share|cite|improve this answer











          answered 2 days ago









          flawr

          10.9k32043




          10.9k32043











          • Yes but what about w = a?b
            – Marine1
            2 days ago










          • What is a?b? Consider posting further questions as seperate posts.
            – flawr
            2 days ago










          • a?b It's a string, it's still the same question
            – Marine1
            2 days ago










          • @Marine1: a?b may be Python syntax for some string, but we're not Python experts enough to know which string that is ...
            – Henning Makholm
            2 days ago











          • @Marine1 if w = a?b and a?b is a string, then so is w, and the answer is also the same.
            – flawr
            2 days ago
















          • Yes but what about w = a?b
            – Marine1
            2 days ago










          • What is a?b? Consider posting further questions as seperate posts.
            – flawr
            2 days ago










          • a?b It's a string, it's still the same question
            – Marine1
            2 days ago










          • @Marine1: a?b may be Python syntax for some string, but we're not Python experts enough to know which string that is ...
            – Henning Makholm
            2 days ago











          • @Marine1 if w = a?b and a?b is a string, then so is w, and the answer is also the same.
            – flawr
            2 days ago















          Yes but what about w = a?b
          – Marine1
          2 days ago




          Yes but what about w = a?b
          – Marine1
          2 days ago












          What is a?b? Consider posting further questions as seperate posts.
          – flawr
          2 days ago




          What is a?b? Consider posting further questions as seperate posts.
          – flawr
          2 days ago












          a?b It's a string, it's still the same question
          – Marine1
          2 days ago




          a?b It's a string, it's still the same question
          – Marine1
          2 days ago












          @Marine1: a?b may be Python syntax for some string, but we're not Python experts enough to know which string that is ...
          – Henning Makholm
          2 days ago





          @Marine1: a?b may be Python syntax for some string, but we're not Python experts enough to know which string that is ...
          – Henning Makholm
          2 days ago













          @Marine1 if w = a?b and a?b is a string, then so is w, and the answer is also the same.
          – flawr
          2 days ago




          @Marine1 if w = a?b and a?b is a string, then so is w, and the answer is also the same.
          – flawr
          2 days ago












           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2871875%2fwhat-is-the-difference-between-the-following-two-tests-w-isupper-and-not-w-i%23new-answer', 'question_page');

          );

          Post as a guest













































































          Comments

          Popular posts from this blog

          What is the equation of a 3D cone with generalised tilt?

          Color the edges and diagonals of a regular polygon

          Relationship between determinant of matrix and determinant of adjoint?