[old] Median [old] Median
Undefined
EN EL ES FR HU KO JA PT-BR RU UK Simplified Chinese
elki

中位数是一个可将数值集合划分为相等的上下两部分的一个数值。如果列表数据的个数是奇数,则列表中间那个数据就是列表数据的中位数;如果列表数据的个数是偶数,则列表中间那2个数据的算术平均值就是列表数据的中位数。在这个任务里,你将得到一个含有自然数的非空数组(X)。你必须把它分成上下两部分,找到中位数。 ...

一个作为数组的整数(int)列表(list)的。

数组的中位数(int, float).

median([1, 2, 3, 4, 5]) == 3
median([3, 1, 2, 5, 3]) == 3
median([1, 300, 2, 200, 1]) == 2
median([3, 6, 20, 99, 10, 15]) == 12.5

中位数在概率论和统计学中得到应用,它偏态分布中有显著的价值。例如:我们想从一组数据中知道人们的平均财富 -- 100人一个月收入100美元,10人一个月收入1,000,000美元。如果我们算平均值,得到的是91000美元。这是一个完全没有向我们展示真实情况的奇怪的值。所以在这种情况下,中位数会给我们更有用的值和较好的描述。


1 < len(data) ≤ 1000
all(0 ≤ x < 10 ** 6 for x in data)

You should be an authorized user in order to see the full description and start solving this mission.
Settings
Code:
CheckiO Extensions

CheckiO Extensions allow you to use local files to solve missions. More info in a blog post.

In order to install CheckiO client you'll need installed Python (version at least 3.8)

Install CheckiO Client first:

pip3 install checkio_client

Configure your tool

checkio --domain=js config --key=

Sync solutions into your local folder

checkio sync

(in beta testing) Launch local server so your browser can use it and sync solution between local file end extension on the fly. (doesn't work for safari)

checkio serv -d

Alternatevly, you can install Chrome extension or FF addon

checkio install-plugin
checkio install-plugin --ff
checkio install-plugin --chromium

Read more here about other functionality that the checkio client provides. Feel free to submit an issue in case of any difficulties.

×
 
 
<< <
> >>
exec

Whats Next?

Free accounts will see Best CheckiO solutions with some delay.
Best Solutions will be opened in
Become Awesome and Don't wait
The next stage is ""
Will be activated in
View More Solutions Random Review Solutions Share your own solution
Go to the next mission Back to the map