Hi, friends. I wanna ask if there is a function which is able to take a list as argument and then return its top-k maximums?
howe.steven at gmail.com
Fri Apr 23 12:36:02 EDT 2010
Really! Learn to use google better. I just used "python sort list"
Look at: http://wiki.python.org/moin/HowTo/Sorting
Read about list.sort. Try, at a command prompt (assuming you have a unix
shell), "pydoc list"
search for sort; read it. It mentions 'reverse'.
then slice the list to your desired set and return.
On 04/23/2010 07:02 AM, Grant Edwards wrote:
> On 2010-04-22, D'Arcy J.M. Cain<darcy at druid.net> wrote:
>> On Thu, 22 Apr 2010 15:04:01 +0100
>> Tim Golden<mail at timgolden.me.uk> wrote:
>>>> So please tell me if there is one or not. I really need this soon.
>>>> Appreciate a lot.
>>> Assuming top-k doesn't mean something obscurely statistical:
>> You really shouldn't do people's homework for them. It doesn't do
>> them any favours.
> Doing people's homework for them is a survival mechanism -- it reduces
> the competence of potential new rivals. :)
> OTOH, if you do end up working with one of those a new grads with a
> diploma but not a clue, you end up worse off because now you have to
> teach them the problem solving skills they didn't learn in school.
More information about the Python-list