median of an array

Run Settings
LanguagePython
Language Version
Run Command
arr = [2.4, 5.1, 6.7, 8.9] arr.sort() if len(arr)%2 == 0: res = (arr[round(len(arr)/2) - 1] + arr[round(len(arr)/2)])/2 else: res = arr[int(len(arr)/2)] print(res)
Editor Settings
Theme
Key bindings
Full width
Lines