#43 Python Tutorial for Beginners | Filter Map Reduce

  Рет қаралды 561,361

Telusko

Telusko

5 жыл бұрын

Spring and Microservices Live Course : bit.ly/springmslive
Coupon: TELUSKO25 (25% Discount)
Industry-Ready Java Spring Microservices Developer Live : bit.ly/JavaMS2
Complete Java Developer Course : bit.ly/Comp-Java-Dev-2
Coupon: TELUSKO20 (20% Discount)
For More Queries WhatsApp or Call on : +919008963671
website : courses.telusko.com/
Instagram : / navinreddyofficial
Linkedin : / navinreddy20
TELUSKO Android App : bit.ly/TeluskoApp
Discord : / discord
In this lecture we will learn:
- Filter Map and Reduce in Python
- Use of filter(), map() and reduce() functions
- How lambda function can be used with filter map and reduce
- Syntax of Filter, Map and reduce function
- Difference between filter(), map() and reduce() functions
#1
- Lambda function can be used with these three functions:
1. filter()
2. map()
3. reduce()
#2
- filter() function will take a list and do filtering and give values.
- filter() takes a sequence and also returns a sequence.
- filter() function takes two arguments: function and iterable.
filter(func, iterable)
- We have to give the definition of a function that we have passed as a condition in an argument.
- The defined function should return a value of either True or False based on the condition.
- Then, filter() will take the value that is returned by the defined function and does perform filtering based on this value.
- In the defined function, we need only two things i.e, a variable and an expression. So, we can also use the lambda function instead of using the normal function to define the condition for a filter.
-Lambda reduces the number of lines of code and makes it more precise.
- Filter() simply returns the iterable passed to it.
#3
- map() function is used when we want to change the value of every element of a list.
- map() function also takes two arguments i.e., a function and an iterable.
map(func, *iterables)
- To get the result as a list, the built-in list() function can be called on the map object.
- We have to define a function that we have passed as a condition in an argument.
- The defined function should return any value.
- The lambda function can also be used in an argument as a function instead of defining the normal function for the logic.
- map() function returns a list. The function returns a map object which is a generator object.
#4
- reduce() function is used to reduce the number of values from a list.
- reduce() function belongs to a module known as functools.
- We have to import the module functools from the library to use the reduce function.
- reduce() also take two arguments i.e., a function and a sequence.
reduce(func, iterable[, initial])
- We have to give the definition of a function that we have passed as a condition in an argument.
- The lambda function can also be used in an argument as a function instead of defining the normal function for the logic.
Python Tutorial to learn Python programming with examples
Complete Python Tutorial for Beginners Playlist : • #1 Python Tutorial for...
Python Tutorial in Hindi : • #1 Python Tutorial | I...
Github :- github.com/navinreddy20/Python-
Java and Spring Framework For beginners with Spring Boot : - bit.ly/3LDMj8D
Java Tutorial for Beginners (2023) :- bit.ly/3yARVbN
Editing Monitors :
amzn.to/2RfKWgL
amzn.to/2Q665JW
amzn.to/2OUP21a.
Subscribe to our other channel:
Navin Reddy : kzfaq.info/love/xmk...
Telusko Hindi :
kzfaq.info/love/itz...
Donation:
PayPal Id : navinreddy20
Patreon : navinreddy20
www.telusko.com/contactus

Пікірлер: 423
@NitinJainNoida
@NitinJainNoida 5 жыл бұрын
Know what is the difference between filter, reduce and map: map: Takes a function f, and a list L1, and returns a list L2 obtained by applying f to every element of L1. Say f is a function that takes x and returns 2x. Then, map(f, [1,2,3,4]) returns [2,4,6,8]. reduce: Takes a binary operator f, a list L and a seed value (or identity element). It returns the seed value if the list is empty. Otherwise, it applies the binary operator f to the seed and first element of L, then applies f to the result of this and the 2nd element of L, and so on till L is exhausted. The result is returned. This can be seen as a generalization of factorial function. filter: Takes a boolean function f and a list L1. It applies the function to each element of L1, and list of those elements that give true is returned. #insmot
@kirubhaharkannan5461
@kirubhaharkannan5461 3 жыл бұрын
Awesome
@mandvi8887
@mandvi8887 3 жыл бұрын
map function always returns an object. One need to convert to list explicitly.
@bountyhead5537
@bountyhead5537 2 жыл бұрын
Thanks brother
@kogurwarsrisai6947
@kogurwarsrisai6947 Жыл бұрын
didn't get about reduce function
@user-ny9xk8sh3z
@user-ny9xk8sh3z 10 ай бұрын
Perfect
@vikrantthakur3818
@vikrantthakur3818 3 жыл бұрын
Finally found a cool programmeer who teaches these concepts in best possible way❤❤😇 Thanks navin sir
@HelloHey12
@HelloHey12 4 жыл бұрын
Lambda is my new crush ,😍😍❤️❤️ I love lambda
@sidskywalker8423
@sidskywalker8423 4 жыл бұрын
Indeed!
@intelligentbrahman1572
@intelligentbrahman1572 3 жыл бұрын
really pandey g,....i am also pandey............are u student??
@divyeshkumarbalar7732
@divyeshkumarbalar7732 5 жыл бұрын
i was married to java and its version 8 features; after watching this i am planning to cheat in my relationship
@mukeshcheemakurthi7933
@mukeshcheemakurthi7933 5 жыл бұрын
you will be presented in the court if you do this :)
@divyeshkumarbalar7732
@divyeshkumarbalar7732 5 жыл бұрын
I will stay faithful to both Ill treat java as a friend (friendzoned)
@sravanichowdary7755
@sravanichowdary7755 4 жыл бұрын
😝
@sumaiyathameem5888
@sumaiyathameem5888 4 жыл бұрын
😃
@INDIAN-kq6yo
@INDIAN-kq6yo 4 жыл бұрын
Java will divorce you
@hemajeyalakshmi9106
@hemajeyalakshmi9106 3 жыл бұрын
oh god! you are simply answering all the questions that pop my head. thank you navin. you have no idea what a great part you are holding in my life. because of you, im fearless and ready to learn programming. thank you for saving my life.
@muskaan3206
@muskaan3206 4 жыл бұрын
Sir, you have made boring topics interesting for us..i love your teaching method..Great job!!
@sunilmaurya3815
@sunilmaurya3815 4 жыл бұрын
the form of steps u choose while teaching is unique and more understandable as compared to other lecturers thank u sir great explanation☺️
@swarnimasingh1232
@swarnimasingh1232 4 жыл бұрын
"that's what programmers do, making things cool" and how cool he looks with that action ;)
@harshwardhansingh617
@harshwardhansingh617 3 жыл бұрын
makkhan lagana band karo rre xD
@webcreationstudio7088
@webcreationstudio7088 3 жыл бұрын
@@harshwardhansingh617 lol tum toh bare heavy driver ho
@Vikranth4A5
@Vikranth4A5 5 жыл бұрын
Navin sir can u make more videos and more concepts as soon as possible because we are understand very easy with ur explaination NOTE : TRY TO MAKE SOME PROJECTS AND SOFTWARE USING THIS CONCEPTS
@hrutikdhumal402
@hrutikdhumal402 4 жыл бұрын
this is one of the best python tutorial series for begineers and the main part is it is free thank you sir
@mohittrivedi1112
@mohittrivedi1112 5 жыл бұрын
Seriously your Python videos are amazing. kudos to you
@RaiyanAlphaRanger
@RaiyanAlphaRanger 2 жыл бұрын
This is so amazing! I learnt a whole lot about not just lambda from this video, but also these three other useful (albeit advances) functions! Thank you so much!
@pareshdandane
@pareshdandane 5 жыл бұрын
I saw you video after 2 months and editing level is whole different level. I got so much inspiration from you. thank you sir for making this video!!
@NitinJainNoida
@NitinJainNoida 5 жыл бұрын
In case anyone need more information about the difference between filter, map and reduce: Difference 1: 1. 'Map' takes all objects in a list and allows you to apply a function to it. The result is usually the same quantity of items as in the main list but with some execution(as specified in the function). 2. 'Filter' takes all objects in a list and runs that through a function to create a new list with all objects that return True in that function. Not necessary that it will output same number of items as present in the main list. Difference 2: 1. In Map you can use multiple iterables definition : map(function_object, iterable1, iterable2,...) 2. Whereas in filter only one iterable can be used definition : filter(function_object, iterable) Difference 3: Further in filter the function_object has to return boolean only. Hope it helps! :) #insmot
@rahulvaswani8866
@rahulvaswani8866 5 жыл бұрын
thanks a lot
@islamgoher
@islamgoher 4 жыл бұрын
Hey, Thanks for this clarification. but, you didn't mention the purpose of reduce function there :)
@vivekpandey5142
@vivekpandey5142 11 ай бұрын
It's helpful
@vkrsoft
@vkrsoft 5 жыл бұрын
Many many thanks Navin for clearing the concept of Map Reduce. You are a gem. Super likes
@PrasannaKumar-zx7gr
@PrasannaKumar-zx7gr 3 жыл бұрын
Than you sir, after working out this problem myself in laptop, this become simple now... You are a greater teacher and thanks for making me to sit here till above 40 video series. Everyday waking up with your videos make my day very active.... Thank you!
@asishraz6173
@asishraz6173 3 жыл бұрын
After a long time, I finally understood the concept of Lambda, Reduce, Map function. Great video and well explained. Thank you so much sir. Now eager to learn more and more every day through your videos. Thank you so much, keep up the great work.
@rohithjohn959
@rohithjohn959 3 жыл бұрын
Sir...your teachings are awesome and you are a blessing to a lot of new programmers
@deepwell8554
@deepwell8554 5 жыл бұрын
You are a teacher of note ... not only a coder ... Thanks for the effort. If I can do anything to help you expand ( other than liking or subscribing ), let me know.
@user-ny9xk8sh3z
@user-ny9xk8sh3z 10 ай бұрын
such a headache of lambda syntax clarified so simply. Thankx.
@sathvikmalgikar2842
@sathvikmalgikar2842 2 жыл бұрын
finally found a good tutor who does'nt just dump all the codes and and leave logic behind completely making it boring and useless to watch. really amazing sir.
@mattshubat
@mattshubat 3 жыл бұрын
Love how you kept in your mistakes. Very honest.
@swethagopu3708
@swethagopu3708 4 жыл бұрын
Your smart explanation helps me to get out of my fear in learning python😍😍😍
@vidhikumawat5876
@vidhikumawat5876 3 жыл бұрын
Navin sir thank you soo much for this series...I learned alot from this series...it is very easy and helpful..thank you soo much for your efforts ☺️☺️
@rohanram7197
@rohanram7197 4 жыл бұрын
Navin sir you are a legend 🙏🏻❣️ Thanks again
@allofmystuffs
@allofmystuffs 3 жыл бұрын
Legend says, the hardest part of programming is naming the variables.
@wwmcgregor9031
@wwmcgregor9031 4 жыл бұрын
Navin you are a great teacher!
@huzaifaelnaeem1620
@huzaifaelnaeem1620 4 жыл бұрын
it's brief and clear .Thank you so much sir
@ashutoshpatil26
@ashutoshpatil26 5 жыл бұрын
simple and clean Explanation thank you sir
@WanderEatLearn
@WanderEatLearn 2 жыл бұрын
Very helpful to me. It's crystal clear. Prior to watching this video I could not understand filter and map.
@dineshr3841
@dineshr3841 3 жыл бұрын
Really awesome explanation about this topic, I really love it and understood very well by ur way of teaching...🙏❤️
@meghhanigam8375
@meghhanigam8375 3 жыл бұрын
You are the best.... no teacher ca teach like you
@a.rhithesh7711
@a.rhithesh7711 3 жыл бұрын
navin sir i am very happy for your lectures, its very clear cut and good ...a request form my side to plan videos on problem solving python, which is used for placements for some lakhs of engineering students...i am expecting that one.
@italiens9905
@italiens9905 3 жыл бұрын
you are awesome teacher ever ... And your teaching style is really energetic
@pvinoth2146
@pvinoth2146 2 жыл бұрын
Hello Sir, Thanks so much for the lessons. I have coded factorial of a number using reduce functions. Its working:-) from functools import reduce s=[] n=int(input("Enter the number")) for i in range(n+1): if i==0: continue else: s.append(i) print(s) total = reduce(lambda a,b: a*b,s) print(total)
@shivakumarreddyp8764
@shivakumarreddyp8764 4 жыл бұрын
This is the Beauty of python.... And sir hats off for ur teaching
@prashantbhatade6367
@prashantbhatade6367 Жыл бұрын
After watching this video my all doubt got clear hats off to sir quality and method of teaching lit.. Tx
@fhdhejeh63
@fhdhejeh63 4 жыл бұрын
you are helping many people sir. keep going
@054_ritesh3
@054_ritesh3 3 жыл бұрын
The next level of awesome teaching
@shantabaikanade6075
@shantabaikanade6075 3 жыл бұрын
You are really a fabulous teacher 🤩🤩🤩
@naveenpolasu4670
@naveenpolasu4670 4 жыл бұрын
Sir, Can you please start Machine learning with Python tutorial.
@ashishgaur862
@ashishgaur862 5 жыл бұрын
Awesome work sir and please make more videos like these and give us some projects and assignment 👍🏻💯
@dipannita7436
@dipannita7436 3 жыл бұрын
u makes the concept understandable
@shreyaswinividhyadhare9228
@shreyaswinividhyadhare9228 4 жыл бұрын
Sir your class is fantastic, more understandable
@dadmehrtatality1144
@dadmehrtatality1144 3 жыл бұрын
Hey man tnx for your help I was really confused but now I find it out !!😍
@muhammadsultanularafin8846
@muhammadsultanularafin8846 4 жыл бұрын
Wonderfully explained! Thanks.
@vanshchauhan2373
@vanshchauhan2373 Жыл бұрын
loved the method of your explaining
@pritvips
@pritvips 5 жыл бұрын
thanks for the videos sir....hats off to your teaching talent
@ritikasharma7849
@ritikasharma7849 4 жыл бұрын
Again a amazing one is there u are a amazing teacher thanku❤️
@amitroy-kh1wn
@amitroy-kh1wn 5 жыл бұрын
Sir, How can you describe so easily and understandably. Hats off Sir
@deepthireddy4036
@deepthireddy4036 Жыл бұрын
I really like the way you explain concepts❤
@cnx_1441
@cnx_1441 3 жыл бұрын
I thought your vids were useless at the first but then I understood that your vids r very helpful thank you soo much.
@venupunna9940
@venupunna9940 3 жыл бұрын
Great tutorial and by the way THANKYOU for making these videos AD FREE.
@iqbalhonnur4451
@iqbalhonnur4451 2 жыл бұрын
Excellent explanation !!!
@b.sasikumar2141
@b.sasikumar2141 4 жыл бұрын
I like the way of u teaching sir superb...... 👌👌
@tenzintsundue6474
@tenzintsundue6474 3 жыл бұрын
Just wanted to let you know that you are amazing!
@milankbudha
@milankbudha 4 жыл бұрын
thank you sir for explaining so easily...
@abhaykanwasi881
@abhaykanwasi881 Жыл бұрын
Big Data concept is so relatable for me to understand this concept.❤❤
@ngharish
@ngharish 3 жыл бұрын
i knew lamda function but filter ,map and reduce is useful for handling huge data ... so thanks for video
@HimanshuVerma-rr2ww
@HimanshuVerma-rr2ww 4 жыл бұрын
So enjoyable your teaching skill. Really i am getting all this things free. Thanks sir great heads off.
@MegaCherry0
@MegaCherry0 4 жыл бұрын
Class Moniter could you please let me know whether this channel has videos on python and are they easy to understand? Thanks in advance.
@truthalonetriumphs6572
@truthalonetriumphs6572 4 жыл бұрын
"Hats off" is the expression
@SaFFire123x
@SaFFire123x 3 жыл бұрын
@@MegaCherry0 This is a reply after 7 months but I can confidently say that this is the best channel for python. I regret not discovering this channel earlier
@MegaCherry0
@MegaCherry0 3 жыл бұрын
SaFFire thank you so much buddy.
@SaFFire123x
@SaFFire123x 3 жыл бұрын
@@MegaCherry0 you're welcome. I'm 7 months late though 😅
@Chillos100
@Chillos100 4 жыл бұрын
You're a genius bro! thnks a lot
@just_a_living_being
@just_a_living_being 5 жыл бұрын
Thank you Sir 😊 awesome explanation
@manojkumarsingh4817
@manojkumarsingh4817 5 жыл бұрын
tnq so much for providing such necessary knowledge on python .plz sir make videos on advance python 😊
@lasithdissanayake
@lasithdissanayake 2 жыл бұрын
this was the only tutorial I undestood about map filter an reduce
@jitendrasharma4
@jitendrasharma4 3 жыл бұрын
Very Nice explanation , Thank you
@mahalingpreethi1021
@mahalingpreethi1021 2 жыл бұрын
Sir, all lambda functions are working similar(filter(),map(),reduce()). Then what is the main difference between them. Among three which function is better to use.
@memeea6484
@memeea6484 Жыл бұрын
Thank you so much the only tutorial that i can actually understand!! ♥♥
@hetpatel7918
@hetpatel7918 3 жыл бұрын
great presentation skills sir
@sudeepa.n.ssudeepa3458
@sudeepa.n.ssudeepa3458 3 жыл бұрын
A legendary session.... ♥️
@uvishnuprasad2944
@uvishnuprasad2944 3 жыл бұрын
from functools import * num = [2,4,5,6,7,8,9,1,0] odds =(list(filter(lambda n: n%2!=0 ,num))) square=(list(map(lambda a: a*a,odds))) sum=(reduce(lambda x,y: x+y,square)) print(sum)
@rituhalder835
@rituhalder835 4 ай бұрын
wowww!! beautifully explained!!
@anubhavshrivastav9611
@anubhavshrivastav9611 5 жыл бұрын
Exceptionally Good!!
@chaithalikshetty480
@chaithalikshetty480 2 жыл бұрын
Sir all I can say is your perfect..
@murodjonsadullaev4674
@murodjonsadullaev4674 4 жыл бұрын
I like the way you teach us, Navin. I am learning a lot from your videos. From this video, I learned how to find Factorials of a number with just two lines of code using reduce. from functools import reduce print(reduce(lambda a, b: a * b, range(1, int(input("Enter a number: ")) + 1))) cool bro, really appreciate your help on learning python :)
@yfjsdgzjdnfn
@yfjsdgzjdnfn Жыл бұрын
Factorial!!!
@vakhariyajay2224
@vakhariyajay2224 Жыл бұрын
Thank you very much. You are a genius.
@ishansaha6299
@ishansaha6299 5 жыл бұрын
Continue this awesome tutorial
@rosia1948
@rosia1948 3 жыл бұрын
Superb explanation bro😊
@aakashmehta7336
@aakashmehta7336 3 жыл бұрын
Hi Navin. Your videos are amazing. I am following your python series. I wanted to know from where did you learn the big data? I saw you said that you have learnt big data. Could you you please let me know the reference please? I want to learn big data.
@chinmaydas4053
@chinmaydas4053 5 жыл бұрын
Very important video but please sir try to upload more videos daily. After uploading complete series please sir make some projects/softwares.. it will be very helpful to understand the real world problems 🙏🙏🙏..
@tasin487
@tasin487 3 жыл бұрын
Best tutorials ever!
@theharshkhar3
@theharshkhar3 Ай бұрын
Good work bro!
@mohammedumarfarhan9900
@mohammedumarfarhan9900 Жыл бұрын
This man is an absolute legend
@lightningspeed6466
@lightningspeed6466 3 жыл бұрын
This was very helpful
@footballismydrug3292
@footballismydrug3292 4 жыл бұрын
Damn bro you are fab 🖤🔥 .
@inganzamarumpu
@inganzamarumpu 4 жыл бұрын
all things are clear but i really like comprehensions
@ruwindarowel8200
@ruwindarowel8200 2 жыл бұрын
Hands down the best place to learn Python❤❤❤❤❤❤
@dishankshah5080
@dishankshah5080 5 жыл бұрын
After completing basic please make some projects.It will give us more help.
@sufiyanmogal1527
@sufiyanmogal1527 2 жыл бұрын
Sir please start with python on these weekend it will help those people who are watching your python playlist
@sufiyanmogal1527
@sufiyanmogal1527 2 жыл бұрын
Nice Explanation sir
@brandm5176
@brandm5176 3 жыл бұрын
Awesome dude!
@tigrayrimey6418
@tigrayrimey6418 3 жыл бұрын
Great lecture!
@saikrishnavadali05
@saikrishnavadali05 3 жыл бұрын
Awesome video!!
@BhuveshDhiman
@BhuveshDhiman 4 жыл бұрын
4:03 best part of the Video thank me later
@acedancer1967
@acedancer1967 4 жыл бұрын
😂😂😂😂🤣🤣🤣
@ShikharShukla99
@ShikharShukla99 4 жыл бұрын
🤣🤣
@arbaazkhan7533
@arbaazkhan7533 4 жыл бұрын
That scene was really funny The way he said
@_.sunnyraj._
@_.sunnyraj._ 3 жыл бұрын
😂
@aradhak
@aradhak 3 жыл бұрын
very nice one
@jaheerkalanthar816
@jaheerkalanthar816 3 жыл бұрын
sir , U r my hero shall i tell in my mother toungue, Marana mass
@allofmystuffs
@allofmystuffs 3 жыл бұрын
Sorry to ask. Which language.?
@iloveyou-gk7cw
@iloveyou-gk7cw 3 жыл бұрын
@@allofmystuffs tamil
@rehithkrishna543
@rehithkrishna543 3 жыл бұрын
Thalaivar 🔥
@ameenshah1164
@ameenshah1164 5 жыл бұрын
hello sir ur tech experts talk series is awesome! when will u be back with that series
@Rohitkumar-tx6jl
@Rohitkumar-tx6jl 2 жыл бұрын
One of the best
@hemanthzoro9899
@hemanthzoro9899 5 жыл бұрын
i have some doubts bro. i cant understand these syntax (i.e) request.setTimeout(timeout[, callback]), request.setSocketKeepAlive([enable][, initialDelay]), request.end([data[, encoding]][,callback]). i can understand basic syntax like run(a,b) is a function with two params, but these syntax makes me confusing ... (timeout[, calback]), ([enable][,initialDelay]), ([noDelay]), ([data[, encoding]][, callback]]). i hope u can clear my doubts. thanks for your useful videos
@harshwardhansingh617
@harshwardhansingh617 3 жыл бұрын
he said that these functions are not easy, but I found them so easy : P
@kunalsapkal2341
@kunalsapkal2341 Жыл бұрын
@navin sir, How can we know that map,reduce or any other functions belongs to which module/tool?
#44 Python Tutorial for Beginners | Decorators
7:33
Telusko
Рет қаралды 575 М.
#45 Python Tutorial for Beginners | Modules
7:20
Telusko
Рет қаралды 602 М.
Would you like a delicious big mooncake? #shorts#Mooncake #China #Chinesefood
00:30
Super sport🤯
00:15
Lexa_Merin
Рет қаралды 20 МЛН
КАКОЙ ВАШ ЛЮБИМЫЙ ЦВЕТ?😍 #game #shorts
00:17
Did you find it?! 🤔✨✍️ #funnyart
00:11
Artistomg
Рет қаралды 123 МЛН
Python: Lambda, Map, Filter, Reduce Functions
9:59
Oggi AI - Artificial Intelligence Today
Рет қаралды 376 М.
Array Method filter map reduce
9:35
Telusko
Рет қаралды 61 М.
Python Lambda Functions??
4:30
b001
Рет қаралды 153 М.
Map() & Filter() in Python 🐍 with execution 👩‍💻🙇💻
7:23
#49 Python Tutorial for Beginners | Class and Object
11:01
Telusko
Рет қаралды 797 М.
Stop Making Clones while Learning Programming
6:09
Telusko
Рет қаралды 54 М.
Apple, как вас уделал Тюменский бренд CaseGuru? Конец удивил #caseguru #кейсгуру #наушники
0:54
CaseGuru / Наушники / Пылесосы / Смарт-часы /
Рет қаралды 4,5 МЛН
5 НЕЛЕГАЛЬНЫХ гаджетов, за которые вас посадят
0:59
Кибер Андерсон
Рет қаралды 826 М.
📱 SAMSUNG, ЧТО С ЛИЦОМ? 🤡
0:46
Яблочный Маньяк
Рет қаралды 1,7 МЛН