mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-05-05 14:28:31 +00:00
Merge pull request #3464 from twigleg2/patch-1
[python3/en] Update integer division
This commit is contained in:
commit
eeeda088e9
@ -41,10 +41,10 @@ Note: This article applies to Python 3 specifically. Check out [here](http://lea
|
|||||||
10 * 2 # => 20
|
10 * 2 # => 20
|
||||||
35 / 5 # => 7.0
|
35 / 5 # => 7.0
|
||||||
|
|
||||||
# Result of integer division truncated down both for positive and negative.
|
# Integer division rounds down for both positive and negative numbers.
|
||||||
5 // 3 # => 1
|
5 // 3 # => 1
|
||||||
5.0 // 3.0 # => 1.0 # works on floats too
|
|
||||||
-5 // 3 # => -2
|
-5 // 3 # => -2
|
||||||
|
5.0 // 3.0 # => 1.0 # works on floats too
|
||||||
-5.0 // 3.0 # => -2.0
|
-5.0 // 3.0 # => -2.0
|
||||||
|
|
||||||
# The result of division is always a float
|
# The result of division is always a float
|
||||||
|
Loading…
Reference in New Issue
Block a user