Am 09.03.2010 13:02, schrieb Peter Otten:
[sum(a for a,b in zip(x,y) if b==c)/y.count(c)for c in y]
[1.5, 1.5, 8.0, 4.0, 4.0, 4.0]
Peter

... pwned.
Should be the fastest and shortest way to do it.

I tried to do something like this, but my brain hurt while trying to visualize list comprehension evaluation orders ;)

Regards,
Michael
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to