Functions in Python | Python Tutorial - Day #20
CodeWithHarry · 2,630 words · 13 min read · EN

Below is the complete, readable transcript of Functions in Python | Python Tutorial - Day #20 by CodeWithHarry on YouTube. Read the full text, copy any part you need, or generate a transcript for any video with our free tool.
In today's video, we will see about functions. What are functions? Sometimes we would like to repeat the logic of our code multiple times. Suppose we want to print from 1 to 15 15 times in our program. And suppose the code to do this task is of 10 lines, then we would not like to repeat these 10 lines in our program. There are
two reasons for this. If we repeat these lines, then if I am changing the code in these lines, then I will have to repeat the program at those 15 places where it is being done. I will have to repeat these lines wherever it is being done. If I have to correct my mistake
in my program, then along with that, it will become very hectic for me. My number of lines will increase. By separating this particular logic of code from the program and making it a separate entity, it will be easy for me to update it. I can do it in 10 places without increasing my number
of lines. So how do I reduce this? I will do it with the help of functions. That is, I will separate the logic and make it a function. I will say, there is a function for adding, there is a function for finding the average, there is a geometric minimum function. Sometimes the logic of functions is very
complicated. For example, suppose a function can be made to find the multiplication table of a given number. There can be a function for adding 10 numbers. There can be a function for finding the average. There can be a function for finding the minimum median mode. So, after separating the logic, we will just refer to finding the minimum of
these numbers. And we will not look at this entry again and again. We will create the function once and then use that function. Whatever I have said, you may not have understood it very well. No problems, friend, we are working on a computer screen right now and I will only agree after explaining this concept to
Transcribe another video
Paste any YouTube, Instagram or TikTok link to get a free transcript.