On Tue, Nov 29, 2011 at 3:04 PM, ADRIAN KELLY <[email protected]>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 - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor