"IT_ForMe" <snice14...@aol.com> wrote
cart = {"apple":2.00, "orange":2.50, "banana":1.75}
You set this up but then don't use it.
Also your problem statement said *some* items were
taxable, implying some were not. You might want to
record whether an item is taxable in the dictionary too.
print cart
apple = 2
orange = 2.5
banana = 1.75
You don't need these lines since they are replicating
your dictionary above
totalprice = 0
You don't need this since you will set totalprice in the next line.
totalprice = apple + orange + banana
You should use the dictionary here, and you could apply
the tax to the taxable items before generating the total.
Also you might like to use a loop to get the total since
the cart might change the number of items in a real
world scenario.
print "your subtotal is 'totalprice'"
taxedprice = (totalprice *.07) + totalprice
It might be easier to just multiple by 1.07
Also it would be good to store the tax as a variable in
case the rate changes.
print "your final price is 'taxedprice'"
prompt = raw_input("are you a student?")
if yes
('taxedprice' / 10) + taxed price = student
you must assign a value to a variable you cannot assign
a variable to an expression.
Also, I thought the students got a discount?
This provides a surcharge!
print "your student price is 'student'
else
print "have a nice day"
You also have some faulty syntax in the last if/else
section which Python will tell you about.
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor