> On Dec 12, 2015, at 2:03 AM, Jim Gallaher wrote:
>
> Hi everyone. I'm reading through a beginners Python book and came up with a
> super simple program. I'm not getting any errors and everything runs through,
> but there's a logical calculation error. What the program does is take an
> amo
Hi Alan,
I'm 100 percent sure I'm wrong. :-) I verified it when I fixed the mistake. The
problem was it was adding in the basePrice and the fixed rates/percentages each
time. So I figured it out when Ian said something about that.
Thanks for everyone's help! :-)
On Sat, Dec 12, 2015 at 01:03:05AM -0600, Jim Gallaher wrote:
> Hi everyone. I'm reading through a beginners Python book and came up
> with a super simple program. I'm not getting any errors and everything
> runs through, but there's a logical calculation error. What the program
> does is take a
I haven't verified this, but you are probably up against some
problem caused by using floating point to store money.
The problem is that, when people see something like the floating
point number, 3.15 they think, aha, this is a decimal number just
like I learned in school when I was 10 years old.
On 12/12/15 07:03, Jim Gallaher wrote:
> For example, if I put in a value of 1, it will output 752.12 as the sub
> total and 753.12 as the grand total. It's off by 1 on sub total and 2 on
> grand total.
Are you sure? Lets check the values...
> basePrice = int(input("Please enter in the price o