Re: [Tutor] Calculation error with a simple program

2015-12-12 Thread Todd Purple via Tutor
> 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

Re: [Tutor] Calculation error with a simple program

2015-12-12 Thread Jim Gallaher
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! :-)

Re: [Tutor] Calculation error with a simple program

2015-12-12 Thread Steven D'Aprano
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

Re: [Tutor] Calculation error with a simple program

2015-12-12 Thread Laura Creighton
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.

Re: [Tutor] Calculation error with a simple program

2015-12-12 Thread Alan Gauld
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