Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
my shopping list at supermarket
#python 2.7.12 shopping_list = ["banana", "orange", "apple"] stock = {"banana": 6,"apple": 0,"orange": 32,"pear": 15} prices = {"banana": 4,"apple": 2,"orange": 1.5,"pear": 3} def compute_bill(food): total = 0 for item in food: if stock[item] > 0: total = total + prices[item] stock[item] = stock[item] - 1 return total print compute_bill(shopping_list)
run
|
edit
|
history
|
help
0
tennis
GardenerList
Lambda
Array Example
wordscapes
single digit
asxsd
Problem: rstring
Nama Bulan Python
16