Skip to content

Instantly share code, notes, and snippets.

@Jayasagar
Created December 18, 2017 12:48
Show Gist options
  • Save Jayasagar/093947da823c1447e5c7758144945f28 to your computer and use it in GitHub Desktop.
Save Jayasagar/093947da823c1447e5c7758144945f28 to your computer and use it in GitHub Desktop.
itemCost = {'item1': 100, 'item2': 10, 'item3': 5}
# Get value using Key
print(itemCost['item1'])
# Put value
itemCost["item4"] = 99
# Length of the dictionary
print(len(itemCost))
# Delete an element using key
del itemCost["item1"]
# List of keys
print(itemCost.keys())
# List of values
print(itemCost.values())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment