#43 Python Tutorial for Beginners | Filter Map Reduce

  Рет қаралды 582,802

Telusko

Telusko

Күн бұрын

Check out our courses:
Spring and Microservices Weekend Live Batch : bit.ly/spring-...
Coupon: TELUSKO10 (10% Discount)
Master Java Spring Development : bit.ly/java-sp...
For More Queries WhatsApp or Call on : +919008963671
website : courses.telusk...
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/nav...
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 : www.youtube.co....
Telusko Hindi :
www.youtube.co....
Donation:
PayPal Id : navinreddy20
Patreon : navinreddy20
www.telusko.com...

Пікірлер: 435
@vikrantthakur3818
@vikrantthakur3818 4 жыл бұрын
Finally found a cool programmeer who teaches these concepts in best possible way❤❤😇 Thanks navin sir
@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 2 жыл бұрын
didn't get about reduce function
@SumanGorkhali-z1k
@SumanGorkhali-z1k Жыл бұрын
Perfect
@muskaan3206
@muskaan3206 5 жыл бұрын
Sir, you have made boring topics interesting for us..i love your teaching method..Great job!!
@nehaaadarsh
@nehaaadarsh 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??
@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☺️
@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.
@Vikranth4A5
@Vikranth4A5 6 жыл бұрын
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
@swarnimasingh1232
@swarnimasingh1232 5 жыл бұрын
"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
@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 5 жыл бұрын
Hey, Thanks for this clarification. but, you didn't mention the purpose of reduce function there :)
@vivekpandey5142
@vivekpandey5142 Жыл бұрын
It's helpful
@mohittrivedi1112
@mohittrivedi1112 6 жыл бұрын
Seriously your Python videos are amazing. kudos to 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.
@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
@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)
@pvinoth2146
@pvinoth2146 3 жыл бұрын
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)
@deepwell8554
@deepwell8554 6 жыл бұрын
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.
@SumanGorkhali-z1k
@SumanGorkhali-z1k Жыл бұрын
such a headache of lambda syntax clarified so simply. Thankx.
@RaiyanAlphaRanger
@RaiyanAlphaRanger 3 жыл бұрын
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!
@HimanshuVerma-rr2ww
@HimanshuVerma-rr2ww 5 жыл бұрын
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 4 жыл бұрын
@@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 4 жыл бұрын
SaFFire thank you so much buddy.
@SaFFire123x
@SaFFire123x 4 жыл бұрын
@@MegaCherry0 you're welcome. I'm 7 months late though 😅
@swethagopu3708
@swethagopu3708 4 жыл бұрын
Your smart explanation helps me to get out of my fear in learning python😍😍😍
@allofmystuffs
@allofmystuffs 4 жыл бұрын
Legend says, the hardest part of programming is naming the variables.
@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.
@zakiasmaa6834
@zakiasmaa6834 Ай бұрын
"that's what programmers do, making things cool" ; thank you a lot Navin Sir
@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
@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 2 жыл бұрын
Factorial!!!
@naveenpolasu4670
@naveenpolasu4670 5 жыл бұрын
Sir, Can you please start Machine learning with Python tutorial.
@beecrofttobiloba1869
@beecrofttobiloba1869 3 ай бұрын
Sir this is very necessary
@vrowmuria
@vrowmuria 6 жыл бұрын
Many many thanks Navin for clearing the concept of Map Reduce. You are a gem. Super likes
@study2learn359
@study2learn359 4 жыл бұрын
how lambda function fetch values from list while using filter, map and reduce function?
@ContentArm
@ContentArm 4 жыл бұрын
The values from the list are passed to the function one by one.
@wqwerisk2895
@wqwerisk2895 27 күн бұрын
Thank you! Wishing you all the best 🙏🏼
@rohithjohn959
@rohithjohn959 4 жыл бұрын
Sir...your teachings are awesome and you are a blessing to a lot of new programmers
@PrasannaKumar-zx7gr
@PrasannaKumar-zx7gr 4 жыл бұрын
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!
@chinmaydas4053
@chinmaydas4053 6 жыл бұрын
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 🙏🙏🙏..
@Think_differently955
@Think_differently955 4 жыл бұрын
Great Playlist for Python. I like it. One doubt here, how a+b added all variables without using any loop?
@mohitsharma4667
@mohitsharma4667 4 жыл бұрын
if we have the list abc = [1,2,3,4] it will take the first two elements from the list and perform the function, the new list now becomes [3,3,4] the process is repeated till we have a single value
@sidskywalker8423
@sidskywalker8423 4 жыл бұрын
@@mohitsharma4667 for e.g , l = [2, 4, 6, 8] >>> reduce(add_all, l) 2 + 4 --> 6 6(2 + 4) + 6 --> 12 12(6 + 6) + 8 --> 20 final sum: 20 that's how reduce() works! :)
@shantabaikanade6075
@shantabaikanade6075 3 жыл бұрын
You are really a fabulous teacher 🤩🤩🤩
@webcreationstudio7088
@webcreationstudio7088 3 жыл бұрын
code --> from functools import reduce def adding(a,b): return a+b def update(n): return n*2 num=[1,2,3,4,5,6,7,8,9,10] even=list(filter(lambda x:x%2==0,num)) print(f"even numbers are {even}") double=list(map(lambda x:x*2,even)) print(f"double of all the even numbers {double}") sum=reduce(lambda x,y:x+y,double) sum=str(sum).center(10) print(f"the addition of all the numbers ae present in the double are {sum}")
@WanderEatLearn
@WanderEatLearn 2 жыл бұрын
Very helpful to me. It's crystal clear. Prior to watching this video I could not understand filter and map.
@ashutoshpatil26
@ashutoshpatil26 6 жыл бұрын
simple and clean Explanation thank you sir
@kaikobadshamim6118
@kaikobadshamim6118 3 ай бұрын
Your teaching technique is so lovely!!!
@huzaifaelnaeem1620
@huzaifaelnaeem1620 5 жыл бұрын
it's brief and clear .Thank you so much sir
@asishraz6173
@asishraz6173 4 жыл бұрын
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.
@jaheerkalanthar816
@jaheerkalanthar816 4 жыл бұрын
sir , U r my hero shall i tell in my mother toungue, Marana mass
@allofmystuffs
@allofmystuffs 4 жыл бұрын
Sorry to ask. Which language.?
@iloveyou-gk7cw
@iloveyou-gk7cw 4 жыл бұрын
@@allofmystuffs tamil
@rehithkrishna543
@rehithkrishna543 4 жыл бұрын
Thalaivar 🔥
@emsshafeeq
@emsshafeeq 6 жыл бұрын
nums =[1,2,3,4,5,6,7] evens = list(map(lambda n: n % 2 == 0,nums)) print(evens) if the function is a condition then it will give true or false according to the input output : [False, True, False, True, False, True, False]
@prashantbhatade6367
@prashantbhatade6367 Жыл бұрын
After watching this video my all doubt got clear hats off to sir quality and method of teaching lit.. Tx
@kumaranshultraqmatix8662
@kumaranshultraqmatix8662 3 жыл бұрын
why the function took parameters a,b from doubles? it could have taken from Evans or nums. How does it work?
@حمزةإمسعودان
@حمزةإمسعودان 2 ай бұрын
Your explanation is very awesome. Thanks a lot!!
@rohanram7197
@rohanram7197 5 жыл бұрын
Navin sir you are a legend 🙏🏻❣️ Thanks again
@oliviayeo5753
@oliviayeo5753 5 жыл бұрын
LAMBDA 4:03 LMAO Thank you for the tutorial!
@pareshdandane
@pareshdandane 6 жыл бұрын
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!!
@aakashmehta7336
@aakashmehta7336 4 жыл бұрын
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.
@pranaymane23
@pranaymane23 4 жыл бұрын
Find average of list: from functools import reduce list = [1,2,3,4,5,6,7,8] ave = reduce(lambda a,b: a+b,list)/len(list) print(ave)
@namratasurve6708
@namratasurve6708 5 жыл бұрын
sir, I am having a doubt in function is_even(n),as you stated over there return a%2==0,how come it is returning a value that is a value from list: nums ,as you have not written return a? is it alternative to this: def is_even(a): if a%2==0: return a
@mattjclay
@mattjclay 5 жыл бұрын
namrata surve There is a reason why it works. If you write something like “ 1 == 2 “ in the python interpreter and run it, it will say False / return False. n%2==0 is an expression that evaluates to either True or False depending on the value of n. We don’t need to return the value of n, we only need to know if it is even. So the function in question returns either true or false, and then filter uses the return value to decide whether or not to keep or disregard the number it is applying the function to.
@namratasurve6708
@namratasurve6708 5 жыл бұрын
Matt clay that concept i knew, my question was that,does just returning true / false returns value also in the calling function?
@mattjclay
@mattjclay 5 жыл бұрын
@@namratasurve6708 Since the function is passed as an argument to the filter function, the value true or false is returned to the filter function. Example: Def name(): Name_to_return = input('What is your name?') return Name_to_return Print(name()) I would recommend researching higher order functions and getting used to using functions as arguments.
@namratasurve6708
@namratasurve6708 5 жыл бұрын
Thanx @@mattjclay actually return n%2=0 returns true if that expression evaluates to be true along with the value in a list format
@wwmcgregor9031
@wwmcgregor9031 5 жыл бұрын
Navin you are a great teacher!
@alokik
@alokik 3 жыл бұрын
Respected sir, in first case instead of "List" I want the values in an "Array" . Kindly help me out.
@omkarmore7017
@omkarmore7017 3 жыл бұрын
why don't we use variable length argument formal args in reduce? how come using a+b it adds all. there is not (a, b*)?
@mattshubat
@mattshubat 4 жыл бұрын
Love how you kept in your mistakes. Very honest.
@lasithdissanayake
@lasithdissanayake 3 жыл бұрын
this was the only tutorial I undestood about map filter an reduce
@tamaladhikari7950
@tamaladhikari7950 8 ай бұрын
Comparaing it with java in java we have to use -> operator here only : and also here we have to write lambda
@vigneshA-qq8xz
@vigneshA-qq8xz 4 жыл бұрын
if we put lambda a,b,c:a+b+c instead of a,b:a+b in reduce() it shows an error , can you explain?
@shubhanshi3009
@shubhanshi3009 4 жыл бұрын
reduce only accepts a function with two arguments.
@voalcalisticTanmay
@voalcalisticTanmay 6 жыл бұрын
I have made a use of lambda and map() method and would like to share .. And here is the snippet : a,b=[int(x) for x in input("Enter two values seperated with spaces : ").split()] tup=( lambda c,d : c+d, lambda c,d : c-d , lambda c,d : c*d , (lambda c,d : (c+d)/2)) dic=dict(zip(('Sum' , 'Difference' , 'Product' , 'Average'),map(lambda x : x(a,b),tup))) for j in dic: print("{} : {}".format(j,dic[j])) Hope this gets useful in some way. Thank You :)
@Rajadahana
@Rajadahana 2 жыл бұрын
What an interesting lesson. As always, enjoyed the lesson very much. I have a small problem. In this lesson, we assigned a list to the variable "doubles". in defining the function as well as when using lambda, we give two variables to take two parameters. So how does Python know which item in the list is which parameter? Also, how does it know after the doing the addition, the added number should be the first variable and the next number in the list should be the second variable. What is the logic behind this iteration? I tried to put myself in the Python's boots (even though it doesn't have legs) :-D but I couldn't. Can anyone offer me a helping hand?
@sushovanbasu
@sushovanbasu 4 жыл бұрын
4:35. How is 'n' getting associated with each element from the array nums?
@md.adittorehan6389
@md.adittorehan6389 4 жыл бұрын
Note: filter only takes second parameter when it is iterable (here list is used). For each item in the list is send to the function or lambda as parameter.
@sufiyanmogal1527
@sufiyanmogal1527 2 жыл бұрын
Sir please start with python on these weekend it will help those people who are watching your python playlist
@shivakumarreddyp8764
@shivakumarreddyp8764 4 жыл бұрын
This is the Beauty of python.... And sir hats off for ur teaching
@nehaaadarsh
@nehaaadarsh 4 жыл бұрын
Sir I have question If we don't use list(map) Then it doesn't give list values It is giving something different 😧😧😭😭 Without using list we can't find list output no matter in which format?
@anshpatidar5842
@anshpatidar5842 4 жыл бұрын
from functools import reduce doubles = [2,3,46,5,6,7,5] f = reduce(lambda a,b:a**b,doubles) print (f) what does this mean....what is the behind the scene in powers and division in a list!
@hemanthzoro9899
@hemanthzoro9899 6 жыл бұрын
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
@MukeshKumar-co5ky
@MukeshKumar-co5ky 4 жыл бұрын
from functools import reduce lst = [2,4,5,25,21,66] evens = list(filter(lambda n : n%2==0,lst)) doubles = list(map(lambda n : n*2,evens)) sum = (reduce(lambda a,b : a+b,doubles)) print(evens) print(doubles) print(sum)
@sumantharaja9224
@sumantharaja9224 2 жыл бұрын
from functools import reduce nums = [1,2,3,4] odds = list(filter(lambda n:n%2==1,nums)) print(odds) x = list(map(lambda n:5*n, odds)) print(x) y = reduce(lambda a,b:a+b,x) print(y) Output [1,3] [5,15] 20
@saiprabhav2664
@saiprabhav2664 4 жыл бұрын
we can use nums.sum right ??? plz help
@mankenasaipriyanka9068
@mankenasaipriyanka9068 5 жыл бұрын
Sir, what is the difference between sum() and reduce() we can directly use sum function to get the sum all the elements in the list
@padmashripatil4462
@padmashripatil4462 5 жыл бұрын
sum(doubles) will give you same ans.but it's limited upto addition only ...reduce() can do whatever you want
@saiKumar-ir4nb
@saiKumar-ir4nb 5 жыл бұрын
sir we will explian how to use conditions using lambda expression???
@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.
@meghhanigam8375
@meghhanigam8375 3 жыл бұрын
You are the best.... no teacher ca teach like you
@srujanapavanpatwari8502
@srujanapavanpatwari8502 4 жыл бұрын
Sir instead of using sum=reduce function simply we can use sum= sum( doubles) ???
@venupunna9940
@venupunna9940 3 жыл бұрын
Great tutorial and by the way THANKYOU for making these videos AD FREE.
@ashishgaur862
@ashishgaur862 6 жыл бұрын
Awesome work sir and please make more videos like these and give us some projects and assignment 👍🏻💯
@atulayagupta785
@atulayagupta785 4 жыл бұрын
from functools import * numbs = [] n=int(input("Enter the number of value to be added:")) for i in range(n): a = int(input("Enter the value: ",)) numbs.append(a) result = reduce(lambda a,b : a+b, numbs) print(numbs) print(result)
@italiens9905
@italiens9905 3 жыл бұрын
you are awesome teacher ever ... And your teaching style is really energetic
@hardikp5192
@hardikp5192 4 жыл бұрын
I have only one doubt, at 4:40 in place of filter if we use map...output comes in terms of true and false ....?!?!?!
@abhaykanwasi881
@abhaykanwasi881 2 жыл бұрын
Big Data concept is so relatable for me to understand this concept.❤❤
@ajaymishra1511
@ajaymishra1511 22 күн бұрын
in js we have same functions in reduce(js version) we pass the default value of accumulator arr.reduce((a,b) => a + b, 0) but how we do it in python
@pavankumar-nb6cn
@pavankumar-nb6cn 4 жыл бұрын
explain why we should write list(filter(fun,seq)). while printing filter(), we are getting . what do you mean by this? explain?
@a.rhithesh7711
@a.rhithesh7711 4 жыл бұрын
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.
@renukadasari4670
@renukadasari4670 2 ай бұрын
it's 2024 still we are following your videos even though its 5 years ago B'coz of your excellent explanation and amazing programming
@akshaydange846
@akshaydange846 4 жыл бұрын
taking input from user performed all the map reduce and filter hope it will help anyone from functools import reduce nums=[] n=int(input('enter the elements')) for i in range(0,n): ele=int(input()) nums.append(ele) even = list(filter(lambda n:n%2==0,nums)) print(even) double=list(map(lambda n:n*2,even)) print(double) sum=reduce(lambda a,b:a+b,double) print(sum)
@mohammedumarfarhan9900
@mohammedumarfarhan9900 2 жыл бұрын
This man is an absolute legend
@nrini16
@nrini16 5 жыл бұрын
Could not understand how a+b function added all values of the list in reduce
@kunalraval44
@kunalraval44 4 жыл бұрын
Yes i agree with this statement
@vipinazad4490
@vipinazad4490 4 жыл бұрын
that is how reduce function works, :At first step, first two elements of sequence are picked and the result is obtained. Next step is to apply the same function to the previously attained result and the number just succeeding the second element and the result is again stored. This process continues till no more elements are left in the container. The final returned result is returned and printed on console. -> in other functions filter/map they are not tend to reduce the value so they are passing only one value at time ..
@MORBIUSGAMING
@MORBIUSGAMING 4 жыл бұрын
Phele evens ka result doubles me use Kiya then doubles ka result reduce me use Kiya and then it will add it and for adding we need 2 variables so a ND b is used
@vigneshA-qq8xz
@vigneshA-qq8xz 4 жыл бұрын
@@vipinazad4490 if we put lambda a,b,c:a+b+c instead of a,b:a+b in reduce() it shows an error , can you explain?
@md.adittorehan6389
@md.adittorehan6389 4 жыл бұрын
@@vigneshA-qq8xz The function must have two parameters not more or less
@bilelrek9240
@bilelrek9240 5 жыл бұрын
Hi thanks .I wanna how long it takes to be a programmer learning by yourself
@vakhariyajay2224
@vakhariyajay2224 2 жыл бұрын
Thank you very much. You are a genius.
@rajarawal1457
@rajarawal1457 6 жыл бұрын
sir, please clarify the cocept of generator and decorator. Thank you
@jk3089
@jk3089 4 жыл бұрын
Sir writing in your background on the computer screen is not visible enough. If you show what you are writing, it can help us more.
@ngharish
@ngharish 3 жыл бұрын
i knew lamda function but filter ,map and reduce is useful for handling huge data ... so thanks for video
@avulaki1291
@avulaki1291 2 жыл бұрын
I got a error in reduce like this : Traceback (most recent call last): File "", line 8, in TypeError: 'int' object is not iterable
@midhunm154
@midhunm154 3 жыл бұрын
f=lambda a: a%2 ==0 >>> nums=[1,2,3,4,5,6,8] >>> evens=list(filter(f,nums)) >>> print(evens) [2, 4, 6, 8] using lambda function..
@pavanadepu566
@pavanadepu566 3 жыл бұрын
Sir, explain how to write code to find factorial of a number using lambda function ....
@dineshr3841
@dineshr3841 3 жыл бұрын
Really awesome explanation about this topic, I really love it and understood very well by ur way of teaching...🙏❤️
@jagannathojha6780
@jagannathojha6780 4 жыл бұрын
is lambda looping all the number provided in "nums", and reduced to add those number?? i mean to say how lambda adding all those number without any loop?
@vidhikumawat5876
@vidhikumawat5876 4 жыл бұрын
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 ☺️☺️
@CloudEnthusiastic
@CloudEnthusiastic Жыл бұрын
@navin sir, How can we know that map,reduce or any other functions belongs to which module/tool?
@sparkersclubesports5743
@sparkersclubesports5743 2 жыл бұрын
Cant we do that with just lambda function instead of these map, reduce and filter?
@dipannita7436
@dipannita7436 4 жыл бұрын
u makes the concept understandable
#44 Python Tutorial for Beginners | Decorators
7:33
Telusko
Рет қаралды 601 М.
АЗАРТНИК 4 |СЕЗОН 2 Серия
31:45
Inter Production
Рет қаралды 1,1 МЛН
Nastya and balloon challenge
00:23
Nastya
Рет қаралды 56 МЛН
Win This Dodgeball Game or DIE…
00:36
Alan Chikin Chow
Рет қаралды 9 МЛН
Map, Filter and Reduce in Python | Python Tutorial - Day #53
13:01
CodeWithHarry
Рет қаралды 196 М.
Python: Lambda, Map, Filter, Reduce Functions
9:59
Oggi AI - Artificial Intelligence Today
Рет қаралды 381 М.
Please Master These 10 Python Functions…
22:17
Tech With Tim
Рет қаралды 158 М.
#49 Python Tutorial for Beginners | Class and Object
11:01
Telusko
Рет қаралды 828 М.
#45 Python Tutorial for Beginners | Modules
7:20
Telusko
Рет қаралды 622 М.
10 Python Comprehensions You SHOULD Be Using
21:35
Tech With Tim
Рет қаралды 146 М.
Pydantic Tutorial • Solving Python's Biggest Problem
11:07
pixegami
Рет қаралды 271 М.