functools.reduce function vs map function what is the difference | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

functools.reduce function vs map function what is the difference

9th Apr 2020, 12:24 PM
Rishi
Rishi - avatar
3 Antworten
+ 8
HonFu By any chance one of them was supposed to be reduce?
9th Apr 2020, 1:06 PM
Lord Krishna
Lord Krishna - avatar
+ 3
Map applies a function on every item of an iterable. Map applies a function on *pairs* of items in an iterable, always returning only one, until only a final value is left. So... totally different thing. 😉
9th Apr 2020, 12:42 PM
HonFu
HonFu - avatar
+ 2
Lord Krishna, now that you say it, the name does seem to suggest that. ;-)
9th Apr 2020, 1:09 PM
HonFu
HonFu - avatar