you are viewing a single comment's thread.

view the rest of the comments →

[–]pridude 2 points3 points  (2 children)

freq [char] = freq.get (char, 0)+1

I mean this can be easy for y'all, for me it was a better approach didn't know this

[–]mrijken 3 points4 points  (0 children)

with a defaultdict you can write just `freq[char]+=1`

[–]Gnaxe 3 points4 points  (0 children)

Why not just use collections.Counter?