Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:11,060 --> 00:00:17,570
I am one and welcome in this news with you in this video, we're going to talk about functions and more
2
00:00:17,570 --> 00:00:20,120
precisely the basic function.
3
00:00:21,470 --> 00:00:32,660
So a function is one of the most important thing in programmation and in Python function is like a variable.
4
00:00:32,720 --> 00:00:34,250
You need to master it.
5
00:00:35,000 --> 00:00:41,630
A function is very helpful when you have to do the same, could you have to apply a code?
6
00:00:41,930 --> 00:00:54,680
But to me, multiple times, for example, if you want to compute the mean of a time series, but for.
7
00:00:56,500 --> 00:01:04,240
1000 times there is you are not going to do a cookie past 1000.
8
00:01:04,420 --> 00:01:10,960
Time to do exactly the same could, but with a little
9
00:01:13,930 --> 00:01:14,770
modification.
10
00:01:15,550 --> 00:01:15,850
So.
11
00:01:17,970 --> 00:01:21,990
To fix this issue, you are going to use a function.
12
00:01:24,150 --> 00:01:26,200
Let me show you a little example.
13
00:01:27,270 --> 00:01:37,740
So to define a function you need to use to define oprah.com, then you put a space and you put the name
14
00:01:37,770 --> 00:01:51,750
of your function, so may function and you open parenthesis, even if your function as no needed parameters.
15
00:01:52,110 --> 00:02:01,560
And then you put the parameters of the input of the function, for example, in or example of compute,
16
00:02:01,650 --> 00:02:14,810
the mean for many times there is the input will be the time series so param one person to person through.
17
00:02:15,660 --> 00:02:22,320
Then you put double pane and you go to the name to the line and you need to have an indentation.
18
00:02:23,940 --> 00:02:34,170
Then you can create for you function a dock, string a and doctrine is very important.
19
00:02:34,530 --> 00:02:34,900
Why?
20
00:02:35,280 --> 00:02:48,750
Because if you work with a very specific project and you create some function, you need to do a documentation
21
00:02:48,750 --> 00:02:51,630
of your new function for you.
22
00:02:51,840 --> 00:03:05,880
If you read the Quran again, but one year later, for example, and for other people which want to
23
00:03:05,880 --> 00:03:07,320
see your code, for example.
24
00:03:07,770 --> 00:03:16,560
So it's very important to tell what the function do, because if you have, for example, one hundred
25
00:03:16,560 --> 00:03:25,950
function, it would be very impossible to understand all of the function without a documentation.
26
00:03:28,050 --> 00:03:31,280
And then here we are good.
27
00:03:31,290 --> 00:03:40,140
I'm not going to put a documentation because we create a very specific and easy function.
28
00:03:40,920 --> 00:03:42,810
So this function?
29
00:03:45,060 --> 00:03:45,510
Just
30
00:03:48,120 --> 00:03:52,590
do the some of the three input.
31
00:03:56,040 --> 00:04:04,740
And to use that function, it is very easy, so you just need to put the name of the function, the
32
00:04:04,740 --> 00:04:09,360
parenthesis and the input that you want to give in the function.
33
00:04:10,080 --> 00:04:16,530
And then in return, we have six because one two three is equal to six.
34
00:04:18,930 --> 00:04:28,860
But sometimes it's very helpful to set default setting in our function.
35
00:04:30,030 --> 00:04:32,880
So, for example, if I teach.
36
00:04:37,230 --> 00:04:45,300
Dysfunction and for any reason, sometime I have just this parameter, and
37
00:04:49,860 --> 00:04:57,030
if I want, I can set default parameter for the bond to end the Bond three.
38
00:04:57,540 --> 00:04:58,860
It means that if.
39
00:05:05,530 --> 00:05:09,340
I use this function, I can use it.
40
00:05:13,100 --> 00:05:23,510
Putting the venue that I want for Bahrain to open three, but if I remove the venue of Pan £210 three
41
00:05:24,020 --> 00:05:30,050
automatically, Biton put three for the bottom two and six for the prime three.
42
00:05:30,590 --> 00:05:35,870
So if I run this, could we have one plus three?
43
00:05:36,170 --> 00:05:38,000
So four plus six.
44
00:05:38,240 --> 00:05:39,140
So 10.
45
00:05:42,110 --> 00:05:47,590
So if I change this, we will have another result.
46
00:05:47,600 --> 00:05:53,030
So it is important we need to understand the power of the function.
47
00:05:54,890 --> 00:06:06,590
And for this video, I want to invite you to see it again and go under difficult for him to ask some
48
00:06:06,590 --> 00:06:08,180
question about function.
49
00:06:08,420 --> 00:06:13,430
If you are not comfortable with this notion.
4840
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.