Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!roy From: Roy Smith Newsgroups: comp.lang.python Subject: Re: how to get the ordinal number in list Date: Sun, 10 Aug 2014 13:10:21 -0400 Organization: PANIX Public Access Internet and UNIX, NYC Lines: 22 Message-ID: References: <53E658CD.5020904@gmail.com> <53e59035$0$29998$c3e8da3$5496439d@news.astraweb.com> <338e8fb0-c9ec-462a-b560-1c1ff77de17e@googlegroups.com> NNTP-Posting-Host: localhost X-Trace: reader1.panix.com 1407690622 10184 127.0.0.1 (10 Aug 2014 17:10:22 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Sun, 10 Aug 2014 17:10:22 +0000 (UTC) User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Xref: csiph.com comp.lang.python:75988 In article , Rustom Mody wrote: > > They haven't figured out yet that the > > first step to solving a problem is to decide what algorithms you're > > going to use, and only then can you start translating that into code. > > They need to be led in small steps towards basic knowledge. > [...] > In my view this is starting from the wrong end. > I do not need to know which kind of adder the hardware is implementing to > use +, which sorting algorithm to use sort, etc. Well, no, but if the problem is, "Find the 5 largest numbers in a list", you might start solving the problem by thinking, "OK, first I'm going to sort the list into descending order, then I'm going to take the first five items from that"(*) Only then would you get down to "OK, how do I sort a list of numbers in this language", and "OK, how do I select the first five items from a list in this language". That's what I mean by first you come up with an algorithm, then you implement it in code. (*) Yes, I know, that's not the optimum way, but it's a reasonable first attempt.