mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
Use consistent example for demonstrating integer vs. float division
I had to do a decent amount of mental math to figure out the old example (11 / 4 => 2). This one (5 / 2 => 2) is easier, and makes the difference vs. float division (5.0 / 2.0 => 2.5) easier to spot.
This commit is contained in:
parent
0c0117a138
commit
6f255a5e62
@ -32,7 +32,7 @@ to Python 2.x. Look for another tour of Python 3 soon!
|
|||||||
|
|
||||||
# Division is a bit tricky. It is integer division and floors the results
|
# Division is a bit tricky. It is integer division and floors the results
|
||||||
# automatically.
|
# automatically.
|
||||||
11 / 4 #=> 2
|
5 / 2 #=> 2
|
||||||
|
|
||||||
# To fix division we need to learn about floats.
|
# To fix division we need to learn about floats.
|
||||||
2.0 # This is a float
|
2.0 # This is a float
|
||||||
|
Loading…
Reference in New Issue
Block a user