View Subcategory
Check if a key exists in a map
Given a map pets
{joe:cat,mary:turtle,bill:canary} print "ok" if an pet exists for "mary"
python
pets = dict(joe='cat', mary='turtle', bill='canary')
if ("mary" in pets) print "ok"
if ("mary" in pets) print "ok"
Retrieve a value from a map
Given a map pets
{joe:cat,mary:turtle,bill:canary} print the pet for "joe" ("cat")
python
print pets['joe']
Add an entry to a map
Given an empty pets map, add the mapping from
"rob" to "dog"
python
pets['rob'] = 'dog'
Remove an entry from a map
Given a map pets
{joe:cat,mary:turtle,bill:canary} remove the mapping for "bill" and print "canary"
python
print pets.pop('bill')
