# [Tutor] if/else option for making a choice

Niclas Rautenhaus n.rautenhaus at gmx.de
Mon Feb 18 19:22:54 CET 2013

```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
The extra items have got set values, but at the moment they all get
summarized, but i want to choose.

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

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

#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)

# 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!")

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130218/0b242906/attachment.html>
```