mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 09:41:36 +00:00
aded negative integer division same as in python3
This commit is contained in:
parent
611a00b510
commit
daf83c9123
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user