Python tutorial - Python function reduce - How to use reduce function in Python

Published: 22 August 2023
on channel: KeeshtuTechnology
26
0

Free Python tutorial for beginners-Python Built in functions - reduce () function - How to use it
#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----------------------
welcome to technology platform so today we are going to see like a reduced function so the reduce function is like a kind of recursion like let me see in detail let's see now let me open idle

so I already used some code for your understanding now let's see this I want to iterate the number I want to add it 1 plus 2 2 plus 3 3 plus 4 I want to do it so for that I have to write like this see number equal to zero normal without reduce I just used four and then I'm initializing the variable zero and then I have to use it like first Loop I am just looping this numbers here and then totally equal to Tal Plus I so now if you want to print total this will give the results 10 1 plus 2 3 3 plus 6 6 plus 4 10 so I have to write it like this to produce the result but instead of that I want to do it by using uh reduce function let's see this so the radius is also like the syntax reduce function name arguments and iteration number something like that I will tell you in detail so now let's see this is the function function name and this is the arguments the numbers I am passing here one two three four here I have to add it like 1 plus 2 3 3 plus 3 6 like that so I declare two variable str1 str2 and this is str1 plus str2 like that I am going to add it now let's see this

okay why it is providing oh okay string is it is not defined like that oh sorry so the reduce is not defined so the radius is like we are not having by default so for that we have to use it this import statement

and then you have to use it this reduce

now you got it 10. so we're just trying to use it this kind of statement instead of that we can directly use reduce statement to iterate so that means how it is iterating it it's it's I already told you like it's a recursion so normally if you give like this whatever you are passing this will take for example numbers I will consider like 5 plus 6 plus 7 plus 8 like that so if you give like this two values only but see this that is six it is producing so one plus two two plus three three plus four like that it will go till the end of the value so now I want to add it I already told you like this iteration number this is the starting number so you should not add like one plus two instead of that you should add like whatever I am giving here just take it that number to add it let's see reduce it and then I'll say like this should start like 1000 the starting number is thousand then thousand plus one thousand plus two like that it should add now see this see 1036 we are getting like this so if you want to produce it here we have to do so many things right so instead of that we can directly use some built-in functions to achieve this so now one more thing is also we have this that is called operator so now if you see this one right I am going to use this I have to use it like this import function tools all whatever the input function I am going to download input operator I just downloaded now see this I just written something adding the number something like that so instead of that I don't want to use it by using this I am going to use like operator dot add here if you give like this you no need to give this kind of Expressions automatically this will add 36. actually multiplies also it should have let's see this Dot

add concordenate count of absolute get item I model inversed let's see multiply I think this one let's see this

so this is multiplying and getting this value but this is very large so let me take it up like one plus two and comma 3 so 1 plus 2 to 6 it should return six

you have to write it here

okay so the numbers it is not initializing till now numbers one now I am going to write it here numbers one so it is returning six so not only this one if you want to Concord in it let's see I already told you right if you use this


On this page of the site you can watch the video online Python tutorial - Python function reduce - How to use reduce function in Python with a duration of hours minute second in good quality, which was uploaded by the user KeeshtuTechnology 22 August 2023, share the link with friends and acquaintances, this video has already been watched 26 times on youtube and it was liked by 0 viewers. Enjoy your viewing!