Colab

prices = {
    "oranges" : 7.99,
    "tomatoes" : 2.9,
    "chicken" : 1
}

print(list(prices.items()))

[('oranges', 7.99), ('tomatoes', 2.9), ('chicken', 1)]
# 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]))

oranges costs 7.99 NIS
tomatoes costs 2.90 NIS
chicken costs 1.00 NIS

oranges costs 7.99 NIS
tomatoes costs 2.90 NIS
chicken costs 1.00 NIS
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))

UK has these major cities: ['London', 'Wigan', 'Macclesfield', 'Bolton']
US has these major cities: ['Miami', 'Springfield', 'New York', 'Boston']
prices["steak"] = 300
print(prices)

#discount
prices["steak"] = 200
print(prices)


{'oranges': 7.99, 'tomatoes': 2.9, 'chicken': 1, 'steak': 300}
{'oranges': 7.99, 'tomatoes': 2.9, 'chicken': 1, 'steak': 200}
prices.pop("steak")
print(prices) # steak is gone

{'oranges': 7.99, 'tomatoes': 2.9, 'chicken': 1}