How to Solve NameError: name 'reduce' is not defined -- functools

Solution: Import the 'reduce' module

# Add the following line to the top of your code
from functools import reduce

 

For more information:
functools reduce