|
|
@ -389,9 +389,6 @@ Point(x=<span class="hljs-number">1</span>, y=<span class="hljs-number">2</span> |
|
|
|
<pre><code class="python language-python hljs"><bool> = <str>.isnumeric() <span class="hljs-comment"># True if str contains only numeric characters.</span> |
|
|
|
<list> = textwrap.wrap(<str>, width) <span class="hljs-comment"># Nicely breaks string into lines.</span> |
|
|
|
</code></pre> |
|
|
|
<pre><code class="python language-python hljs"><str> = bin(<int>) <span class="hljs-comment"># Binary representation starting with '0b'.</span> |
|
|
|
<str> = hex(<int>) <span class="hljs-comment"># Hexadecimal representation starting with '0x'.</span> |
|
|
|
</code></pre> |
|
|
|
<h3 id="char">Char</h3> |
|
|
|
<pre><code class="python language-python hljs"><str> = chr(<int>) <span class="hljs-comment"># Converts int to unicode char.</span> |
|
|
|
<int> = ord(<str>) <span class="hljs-comment"># Converts unicode char to int.</span> |
|
|
@ -503,6 +500,12 @@ Point(x=<span class="hljs-number">1</span>, y=<span class="hljs-number">2</span> |
|
|
|
<el> = choice(<list>) |
|
|
|
shuffle(<list>) |
|
|
|
</code></pre> |
|
|
|
<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> |
|
|
|
<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> |
|
|
|
<int> = int(<span class="hljs-string">'<bin>'</span>, <span class="hljs-number">2</span>) <span class="hljs-comment"># Or: int('<hex>', 16)</span> |
|
|
|
<span class="hljs-string">'0b<bin>'</span> = bin(<int>) <span class="hljs-comment"># Or: '0x<bin>' = hex(<int>)</span> |
|
|
|
</code></pre> |
|
|
|
<h2 id="combinatorics"><a href="#combinatorics" name="combinatorics">#</a>Combinatorics</h2> |
|
|
|
<ul> |
|
|
|
<li><strong>Every function returns an iterator.</strong></li> |
|
|
|