@ -559,16 +559,16 @@ to_exclusive = <range>.stop
| 567.89 | '5.7e+02' | '567.89' | '5.68e+02' | '56789.00%' |
+---------------+-----------------+-----------------+-----------------+-----------------+
< / code > < / pre >
< div > < h3 id = "ints" > Ints< / h3 > < pre > < code class = "python language-python hljs" > {< span class = "hljs-number" > 90< / span > :c} < span class = "hljs-comment" > # 'Z'< / span >
{< span class = "hljs-number" > 90< / span > :b} < span class = "hljs-comment" > # '1011010'< / span >
{< span class = "hljs-number" > 90< / span > :X} < span class = "hljs-comment" > # '5A'< / span >
< div > < h3 id = "ints" > Ints< / h3 > < pre > < code class = "python language-python hljs" > {< span class = "hljs-number" > 90< / span > :c} < span class = "hljs-comment" > # 'Z'< / span >
{< span class = "hljs-number" > 90< / span > :b} < span class = "hljs-comment" > # '1011010'< / span >
{< span class = "hljs-number" > 90< / span > :X} < span class = "hljs-comment" > # '5A'< / span >
< / code > < / pre > < / div >
< div > < h2 id = "numbers" > < a href = "#numbers" name = "numbers" > #< / a > Numbers< / h2 > < div > < h3 id = "types" > Types< / h3 > < pre > < code class = "python language-python hljs" > < int> = int(< float/str/bool> ) < span class = "hljs-comment" > # Or: math.floor(< float> )< / span >
< float> = float(< int/str/bool> ) < span class = "hljs-comment" > # Or: < real> e±< int> < / span >
< complex> = complex(real=< span class = "hljs-number" > 0< / span > , imag=< span class = "hljs-number" > 0< / span > ) < span class = "hljs-comment" > # Or: < real> ± < real> j< / span >
< Fraction> = fractions.Fraction(numerator= < span class = "hljs-number" > 0< / span > , denominator= < span class = "hljs-number " > 1< / span > )
< Decimal> = decimal.Decimal(< str/int/float> )
< div > < h2 id = "numbers" > < a href = "#numbers" name = "numbers" > #< / a > Numbers< / h2 > < div > < h3 id = "types" > Types< / h3 > < pre > < code class = "python language-python hljs" > < int> = int(< float/str/bool> ) < span class = "hljs-comment" > # Or: math.floor(< float> )< / span >
< float> = float(< int/str/bool> ) < span class = "hljs-comment" > # Or: < real> e±< int> < / span >
< complex> = complex(real=< span class = "hljs-number" > 0< / span > , imag=< span class = "hljs-number" > 0< / span > ) < span class = "hljs-comment" > # Or: < real> ± < real> j< / span >
< Fraction> = fractions.Fraction(< span class = "hljs-number" > 0< / span > , < span class = "hljs-number" > 1< / span > ) < span class = "hljs-comment " > # Or: Fraction(numerator=0, denominator= 1) < / span >
< Decimal> = decimal.Decimal(< str/int> ) < span class = "hljs-comment" > # Or: Decimal((sign, digits, exponent))< / span >
< / code > < / pre > < / div > < / div >
@ -577,9 +577,9 @@ to_exclusive = <range>.stop
< li > < strong > Decimal numbers can be represented exactly, unlike floats where < code class = "python hljs" > < span class = "hljs-string" > '1.1 + 2.2 != 3.3'< / span > < / code > .< / strong > < / li >
< li > < strong > Precision of decimal operations is set with: < code class = "python hljs" > < span class = "hljs-string" > 'decimal.getcontext().prec = < int> '< / span > < / code > .< / strong > < / li >
< / ul >
< div > < h3 id = "basicfunctions" > Basic Functions< / h3 > < pre > < code class = "python language-python hljs" > < num> = pow(< num> , < num> ) < span class = "hljs-comment" > # Or: < num> ** < num> < / span >
< num> = abs(< num> ) < span class = "hljs-comment" > # < float> = abs(< complex> )< / span >
< num> = round(< num> [, ±ndigits]) < span class = "hljs-comment" > # `round(126, -1) == 130`< / span >
< div > < h3 id = "basicfunctions" > Basic Functions< / h3 > < pre > < code class = "python language-python hljs" > < num> = pow(< num> , < num> ) < span class = "hljs-comment" > # Or: < num> ** < num> < / span >
< num> = abs(< num> ) < span class = "hljs-comment" > # < float> = abs(< complex> )< / span >
< num> = round(< num> [, ±ndigits]) < span class = "hljs-comment" > # `round(126, -1) == 130`< / span >
< / code > < / pre > < / div >
< div > < h3 id = "math" > Math< / h3 > < pre > < code class = "python language-python hljs" > < span class = "hljs-keyword" > from< / span > math < span class = "hljs-keyword" > import< / span > e, pi, inf, nan, isinf, isnan
@ -597,18 +597,18 @@ to_exclusive = <range>.stop
shuffle(< list> )
< / code > < / pre > < / div >
< 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 >
< int> = int(< span class = "hljs-string" > '< bin> '< / span > , < span class = "hljs-number" > 2< / span > ) < span class = "hljs-comment" > # Or: int('< hex> ', 16)< / 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 >
< span class = "hljs-string" > '0b< bin> '< / span > = bin(< int> ) < span class = "hljs-comment" > # Or: hex(< int> )< / span >
< 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 >
< int> = int(< span class = "hljs-string" > '< bin> '< / span > , < span class = "hljs-number" > 2< / span > ) < span class = "hljs-comment" > # Or: int('< hex> ', 16)< / 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 >
< span class = "hljs-string" > '0b< bin> '< / span > = bin(< int> ) < span class = "hljs-comment" > # Or: hex(< int> )< / span >
< / code > < / pre > < / div >
< div > < h3 id = "bitwiseoperators" > Bitwise Operators< / h3 > < pre > < code class = "python language-python hljs" > < int> = < int> & < int> < span class = "hljs-comment" > # And< / span >
< int> = < int> | < int> < span class = "hljs-comment" > # Or< / span >
< int> = < int> ^ < int> < span class = "hljs-comment" > # Xor (0 if both bits equal)< / span >
< int> = < int> < < n_bits < span class = "hljs-comment" > # Shift left< / span >
< int> = < int> > > n_bits < span class = "hljs-comment" > # Shift right< / span >
< int> = ~< int> < span class = "hljs-comment" > # Compliment (flips bits)< / span >
< div > < h3 id = "bitwiseoperators" > Bitwise Operators< / h3 > < pre > < code class = "python language-python hljs" > < int> = < int> & < int> < span class = "hljs-comment" > # And< / span >
< int> = < int> | < int> < span class = "hljs-comment" > # Or< / span >
< int> = < int> ^ < int> < span class = "hljs-comment" > # Xor (0 if both bits equal)< / span >
< int> = < int> < < n_bits < span class = "hljs-comment" > # Shift left< / span >
< int> = < int> > > n_bits < span class = "hljs-comment" > # Shift right< / span >
< int> = ~< int> < span class = "hljs-comment" > # Compliment (flips bits)< / span >
< / code > < / pre > < / div >
< div > < h2 id = "combinatorics" > < a href = "#combinatorics" name = "combinatorics" > #< / a > Combinatorics< / h2 > < ul >