Fix formatting and remove unnecessary else.

This commit is contained in:
Lipis
2019-12-26 14:39:01 +02:00
committed by GitHub
parent 8122367bf7
commit df9fe81e3e

View File

@ -11,10 +11,9 @@ Sort the numbers of the list using `list.sort()` and find the median, which is e
def median(list): def median(list):
list.sort() list.sort()
list_length = len(list) list_length = len(list)
if list_length%2==0: if list_length % 2 == 0:
return (list[int(list_length/2)-1] + list[int(list_length/2)])/2 return (list[int(list_length / 2) - 1] + list[int(list_length / 2)]) / 2
else: return list[int(list_length / 2)]
return list[int(list_length/2)]
``` ```
```py ```py