cart = {"apple":2.00, "orange":2.50, "banana":1.75} print cart apple = 2 orange = 2.5 banana = 1.75 totalprice = 0 totalprice = apple + orange + banana print "your subtotal is 'totalprice'" taxedprice = (totalprice *.07) + totalprice print "your final price is 'taxedprice'" prompt = raw_input("are you a student?") if yes ('taxedprice' / 10) + taxed price = student print "your student price is 'student' else print "have a nice day"
Robert Berman-2 wrote: > > Yes. > > Show us your solution and perhaps we can help you make it a tad more > efficient. > > Robert Berman > > IT_ForMe wrote: >> Anyone know how to program this using Python >> >> Add up the prices for items in a shopping cart. Some items are taxable >> and >> some items are not. You may assume a 7% tax rate for all taxable items. >> Apply a 10% discount if the customer is a student. (hint, instead of >> asking >> the user to input items, set them up as an associative array in the code) >> > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > -- View this message in context: http://www.nabble.com/Python-help-tp23175541p23227229.html Sent from the Python - tutor mailing list archive at Nabble.com. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor