On 04/05/2013 08:05 AM, Najam Us Saqib wrote:
Hi,

My name is Najam, I am very new to Python Programming.

Welcome.

 Would you please help me with the following question?

The question/problem is,

Write a Car salesman program where the user enters the base price of a car. The 
program should add 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.


Is this exactly the way the assignment reads, or did you paraphrase it?

I am not sure whether I have entered the right code for "Make tax and license a 
percent of the base price." or not.

My program is;

price = float(raw_input("Enter the base price of the car $ "))

tax = float(raw_input("Enter the tax $ "))
licence = float(raw_input("Enter the licence fees $ "))
dealer_prep = float(raw_input("Enter the dealer prep fees $ "))
des_charge = float(raw_input("Enter the destination charge $ "))

percent = (tax * 0.01 + licence * 0.01) / price                                 
  # ?????

print "\nA percent of the base price is: $ " , percent

total = price + tax + licence + dealer_prep + des_charge

print "\nThe actual price of the car is: $ " , total

raw_input("\nPress Enter key to Exit, thank you.")



The way I expect the assignment was intended is that the user should enter (with raw_input) the tax and license as percentages, and you convert them to dollars, rather than the other way around.


--
DaveA
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to