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 of the car: "))

=> 1

> tax = basePrice * .07

=> 0.07

> license = basePrice * .05

=> 0.05
> dealerPrep = basePrice + 500

=> 501

> destinationCharge = basePrice + 250

=> 251

> # Add the total misc charges together
> subTotal = float(tax + license + dealerPrep + destinationCharge)

=> 0.07 + 0.05 + 501 + 251 => 752.12

> # Add all the misic charges and include the base price
> grandTotal = float(subTotal + basePrice)

=> 752.12 + 1 => 753.12

Looks like Python got it right to me?


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to