Home » NameError: name ‘reduce’ is not defined Python

NameError: name ‘reduce’ is not defined Python

To solve NameError: name ‘reduce’ is not defined in Python error follow below methods.

ERROR LOG

NameError: name ‘reduce’ is not defined

How to solve NameError: name ‘reduce’ is not defined in Python ?

Refer the given methods to solve the issue.

It was moved to functools.

from functools import reduce

Hope the above solution works.

Also read :

SyntaxError: cannot assign to operator