d = {"name":"Eric"}
d["age"] = 32 # Brackets can add a key:value pair
d["age"] = 29 # They can also update an existing pair
print(d["age"]) # ...or just to access a value

d.update({"age":50, "job":"Lecturer"})

# Behave the same if the key exists
print(d["name"])     # Prints "Eric"
print(d.get("name")) # Prints "Eric"
# Behave different when the key does not exist
#print(d["salary"])           # Error! Key not in dictionary
print(d.get("salary"))        # No error, no return value
print(d.get("salary", False)) # Returns false

del d["age"] # Removes "age", returns nothing
d.pop("job") # Removes "job", returns its value
print(d) # Now d is just {"name":"Eric"}

"name" in d    # Would evaluate to True
"age" in d     # Would evaluate to False (age was just removed)
"job" not in d # Would evaluate to True

d = {"Manager":"Sally", "Cashier":"Bob", "Security":"Joel"}
for k in d.keys():   # Will print out "Manager", "Cashier", and "Security"
  print(k)

for v in d.values(): # Will print out "Sally", "Bob", "Joel"
  print(v)

for x in d.items(): # Will print out ("Manager", "Sally") ("Cashier", "Bob"), etc...
  print(x)

def dnaFrequency(s):
  d = {}
  for c in s:
    d[c] = d.get(c,0) + 1
  return d