Python reduce function tutorial example explained
#python #reduce #function
reduce() = apply a function to an iterable and reduce it to a single cumulative value.
performs function on first two elements and repeats process until 1 value remains
# reduce(function, iterable)
import functools
letters = ["H","E","L","L","O"]
word = functools.reduce(lambda x, y,:x + y,letters)
print(word)
factorial = [5,4,3,2,1]
result = functools.reduce(lambda x, y,:x * y,factorial)
print(result)
Bro Code merch store 👟 :
===========================================================
https://teespring.com/stores/bro-code-5
===========================================================
На этой странице сайта вы можете посмотреть видео онлайн Python reduce ♻️ длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Bro Code 18 Январь 2021, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 25,578 раз и оно понравилось 1.3 тысяч зрителям. Приятного просмотра!