Sound Wayne, thank you
From: waynejwer...@gmail.com Date: Tue, 29 Nov 2011 15:11:46 -0600 Subject: Re: [Tutor] list, tuple or dictionary To: kellyadr...@hotmail.com CC: tutor@python.org On Tue, Nov 29, 2011 at 3:04 PM, ADRIAN KELLY <kellyadr...@hotmail.com> wrote: thanks guy, i was thinking of using a dictionary:- Stock_list = {"White Bread": 1.24, "Biscuits": 1.77, "Banana" : 0.23, "Tea Bags" : 2.37, "Eggs" : 1.23, "Beans" : 0.57} how would i go about adding, for example tea and eggs to get a subtotal? Why, you would add tea and eggs, of course! print("Subtotal: ", Stock_list["Tea Bags"] + Stock_list["Eggs"]) HTH, Wayne
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor