Perl Christmas Quiz

Nicholas Clark nick at
Mon Dec 15 13:29:39 GMT 2008

On Mon, Dec 15, 2008 at 01:22:49PM +0000, Avleen Vig wrote:
> On Dec 15, 2008, at 10:04, "James Laver" <james.laver at> wrote:
> >On Sun, Dec 14, 2008 at 3:15 PM, Avleen Vig <avleen at> wrote:

> >>In the spirit of sharing, I offer this solution, from your neighbours
> >>in the Python community:
> >>
> >>a = ['m', 'n', 'o', 'o', 'p', 'p', 'q']
> >>b = ['n', 'p', 'q', 'r', 'r', 's']
> >>
> >>def FindSetMatches(list1, list2):
> >>for i in set(list1).intersection(set(list2)):
> >>  print '%s min(%s, %s)' % (i, list1.count(i), list2.count(i))

> Plus I just wanted to be a snob with my four-line solution.

Yes, but can Python do it in one line?

(Sort of a serious question. Not knowing Python, but having this understanding
that all constructions that C (etc) and Perl (etc) would delimit with {},
Python does with whitespace indentation level, I'm figuring that some things
in Python *have* to be done in multiple lines. For maintaining real world
code, this is probably actually a feature, rather than a "feature")

Nicholas Clark

More information about the mailing list