$ ./guess_the_languageProblem Solving — fill the blank
Problem Solving — fill the blank · medium · #116

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 (also accepted: get, get())

dict.get(c, 0) returns the current count or 0 if absent.
Play Problem Solving ▸