update count_by to PEP8

This commit is contained in:
Rohit Tanwar
2018-02-22 21:14:31 +05:30
parent 5e1833c967
commit 6e9f85b89b

View File

@ -10,7 +10,7 @@ Use `map()` to map the values of the list using the given function. Iterate over
def count_by(arr, fn=lambda x: x):
key = {}
for el in map(fn, arr):
key[el] = 0 if not el in key else key[el]
key[el] = 0 if el not in key else key[el]
key[el] += 1
return key
```