Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <6671ce83$0$3620715$882e4bbb@reader.netnews.com>
Deutsch   English   Français   Italiano  
<6671ce83$0$3620715$882e4bbb@reader.netnews.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!news-out.netnews.com!postmaster.netnews.com!us3.netnews.com!not-for-mail
X-Trace: DXC=5nJ<WV_:M\nUW9:WcN5a;fHWonT5<]0TmQ;nb^V>PUff5[gZBW6J?LlRQ?47NQ;EPk]NUZ8^^mT@jJkDJJI@ZjWnWjB\<Me8\Ag@GM\IYO6WZd>Oa:X5b?f8h
X-Complaints-To: support@blocknews.net
Date: Tue, 18 Jun 2024 14:14:27 -0400
MIME-Version: 1.0
User-Agent: Betterbird (Windows)
Subject: Re: Baby X is bor nagain
Newsgroups: comp.lang.c
References: <v494f9$von8$1@dont-email.me>
 <v49seg$14cva$1@raubtier-asyl.eternal-september.org>
 <v49t6f$14i1o$1@dont-email.me>
 <v4bcbj$1gqlo$1@raubtier-asyl.eternal-september.org>
 <v4bh56$1hibd$1@dont-email.me> <v4c0mg$1kjmk$1@dont-email.me>
 <v4c8s4$1lki1$4@dont-email.me> <20240613002933.000075c5@yahoo.com>
 <v4emki$28d1b$1@dont-email.me> <20240613174354.00005498@yahoo.com>
 <v4okn9$flpo$2@dont-email.me> <20240617002924.597@kylheku.com>
 <v4pddb$m5th$1@dont-email.me> <20240618115650.00006e3f@yahoo.com>
 <v4rv0o$1b7h1$1@dont-email.me> <v4s370$1cgrl$1@dont-email.me>
 <v4sbir$1e579$1@dont-email.me>
Content-Language: en-US
From: DFS <nospam@dfs.com>
In-Reply-To: <v4sbir$1e579$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 19
Message-ID: <6671ce83$0$3620715$882e4bbb@reader.netnews.com>
NNTP-Posting-Host: 127.0.0.1
X-Trace: 1718734467 reader.netnews.com 3620715 127.0.0.1:36827
Bytes: 1816

On 6/18/2024 12:11 PM, David Brown wrote:


> if n % 2 == 1 :
>          median = sorted(data)[n // 2]
> else :
>          median = sum(sorted(data)[(n // 2 - 1) : (n // 2 + 1)]) / 2

I think your else formula (n % 2 == 0) is incorrect:

n      = 4
data   = [1,2,3,4]
median = 2.5

Yours appears to sum (1,2,3) = 6 / 2 = 3.

Am I reading it correctly?