Update and rename dictionaries to dictionaries.py

This commit is contained in:
Joe James
2020-02-25 14:15:57 -06:00
committed by GitHub
parent 5fd1de3f8b
commit 95c5f68458

View File

@@ -1,10 +1,16 @@
# DICTIONARIES
# Create a new dictionary with 3 key-value pairs
prices = {'shrimp':8.52, 'chicken':4.35, 'beef':6.28}
print(prices.items())
# to get one item from our prices dictionary, use its key 'chicken' as the index
print('chicken: ', prices['chicken'])
# UPDATE AND ADD TO A DICTIONARY
# if beef already exists, this will update the price.
# if not, it will add beef to the dictionary
prices['beef'] = 2.99
prices['pork'] = 7.55
print(prices.keys())
print(prices.values())