On May 7, 5:39 pm, [EMAIL PROTECTED] wrote:
> Here is my code for a letter frequency counter.  It seems bloated to
> me and any suggestions of what would be a better way (keep in my mind
> I'm a beginner) would be greatly appreciated..

Yours is a little more efficient than this, but here's a compact way
to write what you want.

import heapq

def mostfreq(message):
    return heapq.nlargest(3, set(message), key=message.count)

--
Paul Hankin
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to