title: Replace upper case characters with a 1 and lower case with a 0
body: <p>I'm trying to build a Python code based on a PHP one.
  What I'm struggling with is the ternary operator in Python.</p>
  <p>As you see in the title, I want to replace the uppercase characters in a string with &quot;1&quot; and the lowercase characters with &quot;0&quot;.</p>
  <pre><code>String1: 00X2I00000ABCDa
  Expected result1: 111111111111110
  
  </code></pre>
  <p>PHP Code</p>
  <pre><code>$bits .= (!is_numeric($char) &amp;&amp; $char == strtoupper($char)) ? '1' : '0';
  </code></pre>
  <p><a href="http://webaugur.com/php-snippets/37-phpsnips-salesforce-id-15-to-18chars.html" rel="nofollow noreferrer">This is the complete PHP script</a></p>
  <p>Thank you!</p>