[Tutor] Bothersome NoneType Error for a List object

Alan Gauld alan.gauld at btinternet.com
Wed Jul 4 19:13:36 CEST 2012


On 04/07/12 17:01, Osemeka Osuagwu wrote:

>      lcm = reduce(lambda x, y: x*y, templist)     #my first lambda
> expression! (multiply all members of templist

Congratulations :-)

But you could have done:

import operator
lcm = reduce(operator.mul, templist)

instead.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/





More information about the Tutor mailing list