prices = {
"oranges" : 7.99,
"tomatoes" : 2.9,
"chicken" : 1
}
print(list(prices.items()))
# nice way
for product, price in prices.items():
print("{} costs {:.2f} NIS".format(product, price))
print()
# crappy way
for product in prices.keys():
print("{} costs {:.2f} NIS".format(product, prices[product]))
mydict = {'UK':['London','Wigan','Macclesfield','Bolton'],
'US':['Miami','Springfield','New York','Boston']}
for country, city_list in mydict.items():
print("{} has these major cities: {}".format(country, city_list))
prices["steak"] = 300
print(prices)
#discount
prices["steak"] = 200
print(prices)
prices.pop("steak")
print(prices) # steak is gone