Path: ...!news-out.netnews.com!postmaster.netnews.com!us8.netnews.com!not-for-mail X-Trace: DXC=Agn:lkkRKk:2Z65?TJZPK3HWonT5<]0T=Q;nb^V>PUf65[gZBW6J?L<>8J_kK>kdR9nW`nfUMC^i3c8dZ<8XY_`3Mba][>SC2C7f;]EoU=id56=R Subject: Re: More Funny Stuff From Joel Newsgroups: comp.os.linux.advocacy References: <17d716103c089ab3$7951$675878$802601b3@news.usenetexpress.com> <2ej96j1mbvgiok4q5c57vdlo94itpfu5dt@4ax.com> <6664e989$0$2363151$882e4bbb@reader.netnews.com> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Lines: 87 Message-ID: <666522c8$1$3747325$882e4bbb@reader.netnews.com> NNTP-Posting-Host: 127.0.0.1 X-Trace: 1717904072 reader.netnews.com 3747325 127.0.0.1:40287 Bytes: 3378 On 6/8/2024 7:42 PM, Joel wrote: > DFS wrote: > >>> I can't imagine I'd need anything beyond C. It's true that you generally don't NEED anything beyond C, but a language like Python will save you immense time, depending on the problem. >> I hope you're not gonna pull a Feeb and claim you're a C guru that can >> 'move the Earth', but refuse to show ANY decent code, then make lame >> excuses like "I have other fish to fry". >> >> >> 1) write your own C to sort these 3 names (by last then first): >> >> William Thomas >> Zachary Jones >> Jim Thomas n1 = ['William Thomas','Zachary Jones','Jim Thomas'] n2 = [] for n in n1: n2.append((n.split()[0],n.split()[1])) for n in sorted(n2,key=lambda x: x[1] + x[0]): print(n[0] + ' ' + n[1]) 6 lines of code >> 2) write your own C to count the words in: >> >> "Now is the time for all good men to come to the aid of their country." s = "Now is the time for all good men to come to the aid of their country." print(len(s.split())) 2 LOC >> 3) write your own C to calc the mean, median and mode of: >> >> 1,2,3,4,5,5,6,7,8,9 import statistics n = [1,2,5,4,3,6,7,5,8,9] m = sorted(n,reverse=True) print('Mean =', str(sum(n)/len(n))) print('Median =', (m[4]+m[5])/2) print('Mode =', str(statistics.mode(n))) 6 LOC (note I changed the order of the numbers so the mean/median/mode values - all 5 - weren't so visually predictable. And a more general routine that doesn't use the stats module and handles any length number set is maybe 12 lines of code) >> Why is it I have a VERY strong feeling you and Feeb and C are about to >> be pwned by python? > > > What purpose does coding that serve? That you can at least minimally support your boasting. > I can code, I choose not to Not buying it, pal. I don't believe you can still write C code to accomplish those things. You're way rusty! > because everything's already been coded, by someone else. wtf? You got high yesterday. Why did you get high again today? Joel, Feeb and C: severely pwned by Python