administrata said unto the world upon 2005-02-04 17:59:
I'm programming Car Salesman Program.
It's been "3 days" learning python...
But, i got problem


Write a Car Salesman program where the user enters the base price of a car. The program should add on a bunch of extra fees such as tax, license, dealer prep, and destination charge. Make tax and license a percent of the base price. The other fees should be set values. Display the actual price of the car once all the extras are applied.
>
print "CAR SALESMAN PROGRAM"
print "\nEnter data."
base_price = int(raw_input("Base Price: "))

tax = int(raw_input("/nTax: "))
license1 = int(raw_input("License: "))
dealer = 30
charge = 5
print "Dealer Prep: ", dealer
print "Destination Charge: ", charge

actual_price = (((base_price * tax / 100) + license1 / 100) + dealer +
change
print "\n\nActual price: ", actual_price

raw_input("")

error occurs, i think the problem is in actual_price. but,
I don't know how to comebine percentage and raw_input.
help me...

thx 4 reading... :)

Hi,

a couple of general tips for seeking help:

1) "error occurs" isn't helpful. What's the error? How do you know? Is it that you don't get the expected output? Then show what you get and say what you expected. Is it that you get a traceback giving detailed and helpful information to track down the error? Then include those details in your post. (They might not make sense to you, but they will help helpers help you.)

2) This smells like a homework problem. If it is, say so. That way, no one will think you are trying to get someone to do your homework for you, and will be much more receptive to request for a push in the right direction.

Looking at the line:

actual_price = (((base_price * tax / 100) + license1 / 100) + dealer + change

I see you've 3 '('s, but only 2 ')'s.

Also, because of point (1), I cannot know if this is relevant to your sense that there is an error, but in:

(base_price * tax / 100)

you might try changing 100 to 100.0. Run these through the interpreter:
1 / 10
1 / 10.0
and consult the FAQ on www.python.org for an explanation of the difference.


Best,

Brian vdB

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to