Skip to content

Commit 45c69da

Browse files
committed
Numbers
1 parent ab8591b commit 45c69da

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,9 @@ Format
409409

410410
Numbers
411411
-------
412+
* **Int, float and complex are the only number types.**
413+
* **I use `<num>` to mean any of the above and `<real>` for either int or float.**
414+
412415
```python
413416
<int> = int(<float/str/bool>) # Or: math.floor(<float>)
414417
<float> = float(<int/str/bool>)
@@ -452,7 +455,7 @@ shuffle(<list>)
452455
'0b<bin>' = bin(<int>) # Or: '0x<hex>' = hex(<int>)
453456
```
454457

455-
### Bitwise Operators
458+
### Bitwise
456459
```python
457460
<int> = <int> & <int> # And
458461
<int> = <int> | <int> # Or

index.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,10 @@ <h4 id="inttypes">Int types:</h4>
482482
{<span class="hljs-number">90</span>:b} <span class="hljs-comment"># '1011010'</span>
483483
</code></pre>
484484
<h2 id="numbers"><a href="#numbers" name="numbers">#</a>Numbers</h2>
485+
<ul>
486+
<li><strong>Int, float and complex are the only number types.</strong></li>
487+
<li><strong>I use <code class="python hljs">&lt;num&gt;</code> to mean any of the above and <code class="python hljs">&lt;real&gt;</code> for either int or float.</strong></li>
488+
</ul>
485489
<pre><code class="python language-python hljs">&lt;int&gt; = int(&lt;float/str/bool&gt;) <span class="hljs-comment"># Or: math.floor(&lt;float&gt;)</span>
486490
&lt;float&gt; = float(&lt;int/str/bool&gt;)
487491
&lt;complex&gt; = complex(real=<span class="hljs-number">0</span>, imag=<span class="hljs-number">0</span>) <span class="hljs-comment"># Or: &lt;real&gt; + &lt;real&gt;j</span>
@@ -513,7 +517,7 @@ <h3 id="binhex">Bin, Hex</h3>
513517
&lt;int&gt; = int(<span class="hljs-string">'&lt;bin&gt;'</span>, <span class="hljs-number">2</span>) <span class="hljs-comment"># Or: int('&lt;hex&gt;', 16)</span>
514518
<span class="hljs-string">'0b&lt;bin&gt;'</span> = bin(&lt;int&gt;) <span class="hljs-comment"># Or: '0x&lt;hex&gt;' = hex(&lt;int&gt;)</span>
515519
</code></pre>
516-
<h3 id="bitwiseoperators">Bitwise Operators</h3>
520+
<h3 id="bitwise">Bitwise</h3>
517521
<pre><code class="python language-python hljs">&lt;int&gt; = &lt;int&gt; &amp; &lt;int&gt; <span class="hljs-comment"># And</span>
518522
&lt;int&gt; = &lt;int&gt; | &lt;int&gt; <span class="hljs-comment"># Or</span>
519523
&lt;int&gt; = &lt;int&gt; ^ &lt;int&gt; <span class="hljs-comment"># Xor (0 if both bits equal)</span>

0 commit comments

Comments
 (0)