summaryrefslogtreecommitdiffhomepage
path: root/python3.html.markdown
diff options
context:
space:
mode:
authorEvgeniy Ginzburg <Nad.Oby@gmail.com>2014-08-05 17:41:28 +0300
committerEvgeniy Ginzburg <Nad.Oby@gmail.com>2014-08-05 17:41:28 +0300
commit57036f128f5e874116729e67d8a77cd763f206d5 (patch)
treeb313d2356e8ab7a9538a4b3befdf46589917426c /python3.html.markdown
parent2ff257b551c4a156887b2c630e81f225ea318236 (diff)
aded negative integer division
Diffstat (limited to 'python3.html.markdown')
-rw-r--r--python3.html.markdown7
1 files changed, 3 insertions, 4 deletions
diff --git a/python3.html.markdown b/python3.html.markdown
index bc0c05bd..de6d552a 100644
--- a/python3.html.markdown
+++ b/python3.html.markdown
@@ -38,9 +38,11 @@ Note: This article applies to Python 3 specifically. Check out the other tutoria
# Except division which returns floats by default
35 / 5 # => 7.0
-# Truncation or Integer division
+# Result of integer division truncated down both for positive and negative.
5 // 3 # => 1
5.0 // 3.0 # => 1.0
+-5 // 3 # => -2
+-5.0 // 3.0 # => -2.0
# When you use a float, results are floats
3 * 2.0 # => 6.0
@@ -51,7 +53,6 @@ Note: This article applies to Python 3 specifically. Check out the other tutoria
# Enforce precedence with parentheses
(1 + 3) * 2 # => 8
-
# Boolean values are primitives
True
False
@@ -60,7 +61,6 @@ False
not True # => False
not False # => True
-
# Equality is ==
1 == 1 # => True
2 == 1 # => False
@@ -79,7 +79,6 @@ not False # => True
1 < 2 < 3 # => True
2 < 3 < 2 # => False
-
# Strings are created with " or '
"This is a string."
'This is also a string.'