Hello folks,

 

I would be very pleased if someone is able to help me.

I wrote a small programm, to calculate the grand total for a car.

A basic price can be entered. Given that basic price, a tax peercentage is
calculated and added tot he grand total.


But unfortunately I am stuck with giving the user the choice to select an
additional option!
The extra items have got set values, but at the moment they all get
summarized, but i want to choose.

 

AFAIK I already tried:

 

Print  raw_input ((“Would you like to have leather?“) à then yes or no

If raw_input == yes

      Print Leather (Leather) ß displaying the variables value

 

Plus adding the item at the end to concatenate it with the basic value.

 

I hope it is clear where my problem is.

 

Regards,

 

Niclas

 

My code I already wrote:

-----------------------------

 

 

#Car price calculator

 

# Set variables for additional items

Leather = (500)

int (Leather)

Clima = (1500)

int (Clima)

Hifi = (250)

int (Hifi)

Electrics = (750)

int (Electrics)

Comfort = (2500)

int (Comfort)

 

 

print "\t\t\tWelcome to the car price calculator!"

print "\t\t\tCredits belong to Niclas Rautenhaus"

print "\n\nPlease enter the basic price: "

basic = int (raw_input())

# Tax is a percentage of the basic car price

Tax = basic * 5 / 100

int (Tax)

 

print "\nAdded items:"

# Here the user should have the possibility to pick either yes or no

print "\n\nLeather",(Leather)

print "Clima",(Clima)

print "Hifi", (Hifi)

print "Electrics", (Electrics)

print "Comfort", (Comfort)

print "Tax", (Tax)

 

# Last step: the picked items shall be summarized

 

print "\n\nTotal grand:", basic + Leather + Clima + Hifi \

      + Electrics + Comfort + Tax

 

raw_input ("\nPress the enter key to exit!")

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

Reply via email to