Suggests using builtin functions for median, sample, shuffle, split_lines and zip

This commit is contained in:
Pablo Baeyens
2020-01-04 14:00:20 +01:00
parent 2ba974cd2d
commit ed8394afc8
5 changed files with 10 additions and 0 deletions

View File

@ -7,6 +7,8 @@ Finds the median of a list of numbers.
Sort the numbers of the list using `list.sort()` and find the median, which is either the middle element of the list if the list length is odd or the average of the two middle elements if the list length is even.
[`median`](https://docs.python.org/3/library/statistics.html#statistics.median) provides similar functionality to this snippet.
```py
def median(list):
list.sort()