|
607 | 607 | shuffle(<list>)
|
608 | 608 | </code></pre></div>
|
609 | 609 |
|
610 |
| -<div><h3 id="binhex">Bin, Hex</h3><pre><code class="python language-python hljs"><int> = ±<span class="hljs-number">0</span>b<bin> <span class="hljs-comment"># Or: ±0x<hex></span> |
611 |
| -<int> = int(<span class="hljs-string">'±<bin>'</span>, <span class="hljs-number">2</span>) <span class="hljs-comment"># Or: int('±<hex>', 16)</span> |
612 |
| -<int> = int(<span class="hljs-string">'±0b<bin>'</span>, <span class="hljs-number">0</span>) <span class="hljs-comment"># Or: int('±0x<hex>', 0)</span> |
| 610 | +<div><h3 id="binhex">Bin, Hex</h3><pre><code class="python language-python hljs"><int> = ±<span class="hljs-number">0</span>b<bin> <span class="hljs-comment"># Or: ±0x<hex></span> |
| 611 | +<int> = int(<span class="hljs-string">'±<bin>'</span>, <span class="hljs-number">2</span>) <span class="hljs-comment"># Or: int('±<hex>', 16)</span> |
| 612 | +<int> = int(<span class="hljs-string">'±0b<bin>'</span>, <span class="hljs-number">0</span>) <span class="hljs-comment"># Or: int('±0x<hex>', 0)</span> |
613 | 613 | <span class="hljs-string">'[-]0b<bin>'</span> = bin(<int>) <span class="hljs-comment"># Or: hex(<int>)</span>
|
614 | 614 | </code></pre></div>
|
615 | 615 |
|
616 |
| -<div><h3 id="bitwiseoperators">Bitwise Operators</h3><pre><code class="python language-python hljs"><int> = <int> & <int> <span class="hljs-comment"># And</span> |
617 |
| -<int> = <int> | <int> <span class="hljs-comment"># Or</span> |
618 |
| -<int> = <int> ^ <int> <span class="hljs-comment"># Xor (0 if both bits equal)</span> |
619 |
| -<int> = <int> << n_bits <span class="hljs-comment"># Shift left (>> for right)</span> |
620 |
| -<int> = ~<int> <span class="hljs-comment"># Not (also: -<int> - 1)</span> |
| 616 | +<div><h3 id="bitwiseoperators">Bitwise Operators</h3><pre><code class="python language-python hljs"><int> = <int> & <int> <span class="hljs-comment"># And</span> |
| 617 | +<int> = <int> | <int> <span class="hljs-comment"># Or</span> |
| 618 | +<int> = <int> ^ <int> <span class="hljs-comment"># Xor (0 if both bits equal)</span> |
| 619 | +<int> = <int> << n_bits <span class="hljs-comment"># Shift left (>> for right)</span> |
| 620 | +<int> = ~<int> <span class="hljs-comment"># Not (also: -<int> - 1)</span> |
621 | 621 | </code></pre></div>
|
622 | 622 |
|
623 | 623 | <div><h2 id="combinatorics"><a href="#combinatorics" name="combinatorics">#</a>Combinatorics</h2><ul>
|
|
0 commit comments