From 45c69dab6a2dae17792866b821b9dfca1b700838 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Fri, 21 Jun 2019 07:28:59 +0200 Subject: [PATCH] Numbers --- README.md | 5 ++++- index.html | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 647ee99..52344f7 100644 --- a/README.md +++ b/README.md @@ -409,6 +409,9 @@ Format Numbers ------- +* **Int, float and complex are the only number types.** +* **I use `` to mean any of the above and `` for either int or float.** + ```python = int() # Or: math.floor() = float() @@ -452,7 +455,7 @@ shuffle() '0b' = bin() # Or: '0x' = hex() ``` -### Bitwise Operators +### Bitwise ```python = & # And = | # Or diff --git a/index.html b/index.html index fddf545..15636f1 100644 --- a/index.html +++ b/index.html @@ -482,6 +482,10 @@ Point(x=1, y=2 {90:b} # '1011010'

#Numbers

+
    +
  • Int, float and complex are the only number types.
  • +
  • I use <num> to mean any of the above and <real> for either int or float.
  • +
<int>     = int(<float/str/bool>)    # Or: math.floor(<float>)
 <float>   = float(<int/str/bool>)
 <complex> = complex(real=0, imag=0)  # Or: <real> + <real>j
@@ -513,7 +517,7 @@ shuffle(<list>)
 <int>     = int('<bin>', 2)    # Or: int('<hex>', 16)
 '0b<bin>' = bin(<int>)         # Or: '0x<hex>' = hex(<int>)
 
-

Bitwise Operators

+

Bitwise

<int>     = <int> & <int>      # And
 <int>     = <int> | <int>      # Or
 <int>     = <int> ^ <int>      # Xor (0 if both bits equal)