From 6f255a5e62ead8d40c4d254dcc63488e543e68d8 Mon Sep 17 00:00:00 2001 From: Brian Rue Date: Fri, 28 Jun 2013 15:55:23 -0700 Subject: [PATCH 1/2] 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. --- python.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python.html.markdown b/python.html.markdown index a599f5d3..20e4f3a8 100644 --- a/python.html.markdown +++ b/python.html.markdown @@ -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 # automatically. -11 / 4 #=> 2 +5 / 2 #=> 2 # To fix division we need to learn about floats. 2.0 # This is a float From cf98f74d6147e1aded5a863298f9cb1446d5da23 Mon Sep 17 00:00:00 2001 From: Brian Rue Date: Fri, 28 Jun 2013 15:55:23 -0700 Subject: [PATCH 2/2] Use consistent example for demonstrating integer vs. float division --- python.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python.html.markdown b/python.html.markdown index 20e4f3a8..93fe5f25 100644 --- a/python.html.markdown +++ b/python.html.markdown @@ -36,7 +36,7 @@ to Python 2.x. Look for another tour of Python 3 soon! # To fix division we need to learn about floats. 2.0 # This is a float -5.0 / 2.0 #=> 2.5 ahhh...much better +11.0 / 4.0 #=> 2.75 ahhh...much better # Enforce precedence with parentheses (1 + 3) * 2 #=> 8