Browse Source

Numbers

pull/54/head
Jure Šorn 4 years ago
parent
commit
b180926077
2 changed files with 22 additions and 22 deletions
  1. 22
      README.md
  2. 22
      index.html

22
README.md

@ -506,7 +506,7 @@ from math import log, log10, log2
### Statistics
```python
from statistics import mean, median, variance, pvariance, pstdev
from statistics import mean, median, variance, stdev, pvariance, pstdev
```
### Random
@ -520,20 +520,20 @@ shuffle(<list>)
### Bin, Hex
```python
<int> = 0b<bin> # Or: 0x<hex>
<int> = int('<bin>', 2) # Or: int('<hex>', 16)
<int> = int('0b<bin>', 0) # Or: int('0x<hex>', 0)
'0b<bin>' = bin(<int>) # Or: hex(<int>)
<int> = 0b<bin> # Or: 0x<hex>
<int> = int('±<bin>', 2) # Or: int('±<hex>', 16)
<int> = int('±0b<bin>', 0) # Or: int('±0x<hex>', 0)
'[-]0b<bin>' = bin(<int>) # Or: hex(<int>)
```
### Bitwise Operators
```python
<int> = <int> & <int> # And
<int> = <int> | <int> # Or
<int> = <int> ^ <int> # Xor (0 if both bits equal)
<int> = <int> << n_bits # Shift left
<int> = <int> >> n_bits # Shift right
<int> = ~<int> # Compliment (flips bits)
<int> = <int> & <int> # And
<int> = <int> | <int> # Or
<int> = <int> ^ <int> # Xor (0 if both bits equal)
<int> = <int> << n_bits # Shift left
<int> = <int> >> n_bits # Shift right
<int> = ~<int> # Compliment (flips bits)
```

22
index.html

@ -587,7 +587,7 @@ to_exclusive = &lt;range&gt;.stop
<span class="hljs-keyword">from</span> math <span class="hljs-keyword">import</span> log, log10, log2
</code></pre></div>
<div><h3 id="statistics">Statistics</h3><pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> statistics <span class="hljs-keyword">import</span> mean, median, variance, pvariance, pstdev
<div><h3 id="statistics">Statistics</h3><pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> statistics <span class="hljs-keyword">import</span> mean, median, variance, stdev, pvariance, pstdev
</code></pre></div>
<div><h3 id="random">Random</h3><pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> random <span class="hljs-keyword">import</span> random, randint, choice, shuffle
@ -597,18 +597,18 @@ to_exclusive = &lt;range&gt;.stop
shuffle(&lt;list&gt;)
</code></pre></div>
<div><h3 id="binhex">Bin, Hex</h3><pre><code class="python language-python hljs">&lt;int&gt; = <span class="hljs-number">0</span>b&lt;bin&gt; <span class="hljs-comment"># Or: 0x&lt;hex&gt;</span>
&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>
&lt;int&gt; = int(<span class="hljs-string">'0b&lt;bin&gt;'</span>, <span class="hljs-number">0</span>) <span class="hljs-comment"># Or: int('0x&lt;hex&gt;', 0)</span>
<span class="hljs-string">'0b&lt;bin&gt;'</span> = bin(&lt;int&gt;) <span class="hljs-comment"># Or: hex(&lt;int&gt;)</span>
<div><h3 id="binhex">Bin, Hex</h3><pre><code class="python language-python hljs">&lt;int&gt; = <span class="hljs-number">0</span>b&lt;bin&gt; <span class="hljs-comment"># Or: 0x&lt;hex&gt;</span>
&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>
&lt;int&gt; = int(<span class="hljs-string">'±0b&lt;bin&gt;'</span>, <span class="hljs-number">0</span>) <span class="hljs-comment"># Or: int('±0x&lt;hex&gt;', 0)</span>
<span class="hljs-string">'[-]0b&lt;bin&gt;'</span> = bin(&lt;int&gt;) <span class="hljs-comment"># Or: hex(&lt;int&gt;)</span>
</code></pre></div>
<div><h3 id="bitwiseoperators">Bitwise Operators</h3><pre><code class="python language-python hljs">&lt;int&gt; = &lt;int&gt; &amp; &lt;int&gt; <span class="hljs-comment"># And</span>
&lt;int&gt; = &lt;int&gt; | &lt;int&gt; <span class="hljs-comment"># Or</span>
&lt;int&gt; = &lt;int&gt; ^ &lt;int&gt; <span class="hljs-comment"># Xor (0 if both bits equal)</span>
&lt;int&gt; = &lt;int&gt; &lt;&lt; n_bits <span class="hljs-comment"># Shift left</span>
&lt;int&gt; = &lt;int&gt; &gt;&gt; n_bits <span class="hljs-comment"># Shift right</span>
&lt;int&gt; = ~&lt;int&gt; <span class="hljs-comment"># Compliment (flips bits)</span>
<div><h3 id="bitwiseoperators">Bitwise Operators</h3><pre><code class="python language-python hljs">&lt;int&gt; = &lt;int&gt; &amp; &lt;int&gt; <span class="hljs-comment"># And</span>
&lt;int&gt; = &lt;int&gt; | &lt;int&gt; <span class="hljs-comment"># Or</span>
&lt;int&gt; = &lt;int&gt; ^ &lt;int&gt; <span class="hljs-comment"># Xor (0 if both bits equal)</span>
&lt;int&gt; = &lt;int&gt; &lt;&lt; n_bits <span class="hljs-comment"># Shift left</span>
&lt;int&gt; = &lt;int&gt; &gt;&gt; n_bits <span class="hljs-comment"># Shift right</span>
&lt;int&gt; = ~&lt;int&gt; <span class="hljs-comment"># Compliment (flips bits)</span>
</code></pre></div>
<div><h2 id="combinatorics"><a href="#combinatorics" name="combinatorics">#</a>Combinatorics</h2><ul>

Loading…
Cancel
Save