Oct 25, 2017

python name 'reduce' is not defined

You can add
from functools import reduce
before you use the reduce.