Merge pull request #220 from azanbinzahid/patch-1

fix #219
This commit is contained in:
Isabelle Viktoria Maciohsek
2020-09-25 12:03:58 +03:00
committed by GitHub

View File

@ -14,10 +14,10 @@ def median(list):
list_length = len(list)
if list_length % 2 == 0:
return (list[int(list_length / 2) - 1] + list[int(list_length / 2)]) / 2
return list[int(list_length / 2)]
return float(list[int(list_length / 2)])
```
```py
median([1,2,3]) # 2
median([1,2,3]) # 2.0
median([1,2,3,4]) # 2.5
```