NameError: name 'reduce' is not defined in Python
Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Magic Ocean Looping
--
Chapters
00:00 Question
00:44 Accepted answer (Score 340)
00:55 Answer 2 (Score 265)
01:10 Answer 3 (Score 10)
01:23 Answer 4 (Score 3)
01:40 Thank you
--
Full question
https://stackoverflow.com/questions/8689...
Accepted answer links:
[functools]: http://docs.python.org/py3k/library/func...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #reduce #python32
#avk47
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Magic Ocean Looping
--
Chapters
00:00 Question
00:44 Accepted answer (Score 340)
00:55 Answer 2 (Score 265)
01:10 Answer 3 (Score 10)
01:23 Answer 4 (Score 3)
01:40 Thank you
--
Full question
https://stackoverflow.com/questions/8689...
Accepted answer links:
[functools]: http://docs.python.org/py3k/library/func...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #reduce #python32
#avk47
ACCEPTED ANSWER
Score 347
It was moved to functools.
ANSWER 2
Score 277
You can add
from functools import reduce
before you use the reduce.
ANSWER 3
Score 10
Or if you use the six library
from six.moves import reduce
ANSWER 4
Score 4
Reduce function is not defined in the Python built-in function. So first, you should import the reduce function
from functools import reduce