This video demonstrates how to use reduce function in Python.

Explore my tutorials:

More awesome topics covered here:
WhatsApp Bot using Twilio and Python:
Discovering Hidden APIs:
RegEx in Python:
Introduction to Numpy:
Introduction to Matplotlib:
Introduction to Pandas:
Intermediate Python:
Functional Programming in Python:
Python Package Publishing:
Multithreading in Python:
Multiprocessing in Python:
Parallel Programming in Python:
Concurrent Programming in Python:
Dataclasses in Python:
Exploring YouTube Data API:
Jupyter Notebook (Tips, Tricks and Hacks):
Decorators in Python:
Inside Python:
Exploring datetime:
Computer Vision for noobs:
Python for web:
Awesome Linux Terminal:
Tips, tricks, hacks and APIs:
Optical Character Recognition:
Facebook Messenger Bot Tutorial:

Facebook:
Github:
Twitter:

#python #reduce #function

Nguồn: https://shaarique.com/

Xem thêm bài viết khác: https://shaarique.com/cong-nghe/

9 Comments

Indian Pythonista

June 29, 2020

In python3, simply do this:
from functools import reduce
then you can use reduce as explained in the video.

Reply

Gambler Tech

June 29, 2020

in your first step of explanation you said x is give 1 and y is given 1 here i'm confused just want to know where is given y=1. I think you're wrong here….it must be x=1 and y=2 in your first step.

Reply

Kumar Atul

June 29, 2020

In newer version of python….u gotta import it from functools

Reply

Grace Tan

June 29, 2020

can i use list comprehension to replace lambda reduce function? some say yes, some say no. please use this as the example, i really appreciate if someone can help me with this. Here is how i got the result by using lambda.
from functools import reduce
n = [23, 45, 68, 23, 45, 35]
result = (reduce(lambda x, y: x * y, n))
print(result)
the result is 2549515500.

how about list comprehension?

Reply

Acu

June 29, 2020

You're aweosome, thank you!

Reply

Kali Battula

June 29, 2020

In the first step, first two elements of sequence are picked and the result is obtained.
1 2 =2
3 2 =6
4 6 =24
5 24 =120

Thank u👍👍

Reply

jowadul kader

June 29, 2020

thanks for the videos.very helpful.please make some on data structure and algo.

Reply

Prog Nauts

June 29, 2020

Only for Python2

Reply

Abishek Kumar

June 29, 2020

u are gooooooooood

Reply

Leave a Reply