Fill the blank
# returns the count of each character in s
def freq(s):
counts = {}
for c in s:
counts[c] = counts.____(c, 0) + 1
return counts
Answer: get
dict.get(c, 0) returns the current count or 0 if absent.
Play Problem Solving ▸