From daf83c91232a259eee4cadef5f28210b7c83316d Mon Sep 17 00:00:00 2001 From: Evgeniy Ginzburg Date: Wed, 6 Aug 2014 23:43:37 +0300 Subject: aded negative integer division same as in python3 --- python.html.markdown | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'python.html.markdown') diff --git a/python.html.markdown b/python.html.markdown index b7d5895a..312e3c15 100644 --- a/python.html.markdown +++ b/python.html.markdown @@ -45,9 +45,11 @@ to Python 2.x. Look for another tour of Python 3 soon! 2.0 # This is a float 11.0 / 4.0 # => 2.75 ahhh...much better -# Truncation or Integer division +# Result of integer division truncated down both for positive and negative. 5 // 3 # => 1 5.0 // 3.0 # => 1.0 # works on floats too +-5 // 3 # => -2 +-5.0 // 3.0 # => -2.0 # Modulo operation 7 % 3 # => 1 -- cgit v1.2.3