[sf-lug] [PYCLASS] Still on exercise 2.1
jim
jim at well.com
Fri Oct 3 21:00:51 PDT 2008
(hint) read the section in the chapter about
integer division compared with floating point
division. the way you express the operands
(numbers) makes a difference.
On Fri, 2008-10-03 at 20:17 -0700, Christian Einfeldt wrote:
> hi,
>
> Okay, with Jim's help, I was able to get past exercise 2.2. Now I am
> on exercise 2.4.1, which poses this question:
>
> The volume of a sphere with radius R is 4/3piRcubed. What is the
> volume of a sphere with radius 5?
>
> I have been vexed by this problem. As the problem is written, I am
> interpretting it to ask me to first divide 4 by 3. Then, I am asked
> to multiple the product of that figure by piRcubed. We are told that
> the answer is _not_ 392.6, but that is the only answer that I seem to
> be able to produce. Any thoughts? My results are below:
>
> >>> (4/3)*(pi*5**3)
> 392.69874999999996
> >>> (4/3)*pi*(5**3)
> 392.69874999999996
> >>> (4/3)*(pi*(5**3))
> 392.69874999999996
> >>> ((4/3)*pi)*(5**3)
> 392.69874999999996
> >>>
>
More information about the sf-lug
mailing list