Update max_by.md

This commit is contained in:
Angelos Chalaris
2019-09-22 15:35:10 +03:00
committed by GitHub
parent 5ad7ee960b
commit 159cc26814

View File

@ -5,11 +5,11 @@ tags: math,list,function,beginner
Returns the maximum value of a list, after mapping each element to a value using the provided function.
Use `map()` with `fn` to map each element to a value using the provided function, convert to a `list` and use `max()` to return the maximum value.
Use `map()` with `fn` to map each element to a value using the provided function, use `max()` to return the maximum value.
```py
def max_by(lst, fn):
return max(list(map(fn,lst)))
return max(map(fn,lst))
```
```py