Free Python tutorial for beginners-Python Built in functions - Filter() function - How to use it
Subscribe Here -https://www.youtube.com/@KeeshtuTechn...
#python#pythonprogramming #pythontutorial #pythonforbeginners #pythonclass #youtubechannels #pythoninstallationcomplete #pythonhowtoinstall #pythoninstall #pythondownload #pythontutorialfree #pythonyoutube #pythonenglish #pythonenglish #pythonexecvseval #pythonexec()vseval() #pythonexec() #pythoneval() #youtubeviews #pythondef #pythondef() #pythonfunctions #pythonbreak #pythoncontinue #pythonpass #pythonzip #pythonunzip #pythonprintescapecharacter #pythonrepr() #python #pythonmap #pythonfunction #pythonfunctions #pythonlamdba
Please Captions on - Python in English, Python in Tamil, Python in Telugu, Python in Malayalam, Python in Chinese, Python in Japanese, Python in German, Python in Hindi, Python in French, Python full course for beginners
----------------------------Transcript------------------------------------
hello welcome to technology platform so today we are going to say like filter functions how to use it earlier we have seen like map Lambda now we are going to see filter let me open idle
now let's see this so this is something I already returned some code let me explain to you
so normally if you want to find some even number so what we are writing a code here is like this first we are declaring a values numbers equal to one two three four five six in this I want to find it which is even number 2 4 6 is the even number so depth function name and then arguments this numbers I am just passing here and then even number equal to empty because this one I have to print it 246 here by using this variable I have to print it so first initializing the mtra now see this for in numbers this one I am passing it if I divided by 2 and we are getting 0 value here I am just applying the filtering condition then this even number dot adding the value and written even number this one I have to return it so now let's see this I have to declare this one numbers
you no need to declare as well so let's see this first diff just create this function now let's see this now the function is created so what we returned function name numbers even number is MTR and then I'm just looping whatever I'm going to provide it that should be Loop and then that number is divided by 2 and if it is 0 then that number should be added in the list and then it should return the even number this is what now I have to print like this so instead of that I will say like 7 8 9 10 like this now I am just going to call this function I'll simply call like this
now let's see this 2 4 6 8 10 it is providing here so and also I will tell you like this app and write why we written up and so if you are not using this app and instead of that you can simply say like even number something like this um equal to I something then it will return the last value it won't update so because of that we are adding this you got it right otherwise 10 only it should return so if you are not providing this up and value it should return the last value 10 but we need to get it in each Loop we need to add one by one so because of that we are giving like this now this is very tough code right it is taking some time to write so for that we are going to use filter method to achieve this in a single line so this is what I written here see this even number this is a name and then filter so the syntax is like filter function name comma iterable so I trade it should be iterate now the function name is like I don't want to use any function so I return here like this this is the function name and then this numbers I'm going to pass it here now let's see this this is one I want to copy or else I'll write it here it see this print I will say like find even number filter this is the variable I used now filter function name comma and then
variables like this numbers I want to give it here I given that variable the function name I need to write right instead of this this kind of big one using Lambda I am assuming this say Lambda you already seen like here Lambda the variable declaration we have to use it for that I used numbers so the numbers is the variable I use numbers then colon then I have to use it like numbers divided by 2 is equal to 0 that's it I think now let's see this now you have to call this filter okay call this filter now let's see this oh so you have to use it like list something like that so this is I already told you like if you are using map something like that you cannot directly call by using list you have to call it like this see this you're achieving 2 4 6 8 10 by using the single line you are able to achieve this kind of filter and why we need to use this kind of functions we can use it simply and this is the function name and directly we are achieving by using this filter function see you in the next class bye
Nesta página do site você pode assistir ao vídeo on-line Python tutorial - Python function Filter - How to use reduce Filter in Python duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário KeeshtuTechnology 21 Agosto 2023, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 44 vezes e gostou 2 espectadores. Boa visualização!