1
00:00:00,000 --> 00:00:00,000
Hello guys.

2
00:00:00,000 --> 00:00:03,000
So we are going to continue the discussion with respect to Python.

3
00:00:03,000 --> 00:00:07,000
And in this video we are going to discuss about modules and packages.

4
00:00:07,000 --> 00:00:08,000
Now in Python.

5
00:00:08,000 --> 00:00:10,000
Uh, you know already it is an open source programming language.

6
00:00:10,000 --> 00:00:13,000
And as you all know that it has lot of packages.

7
00:00:13,000 --> 00:00:16,000
You know which through which you can actually use those packages.

8
00:00:16,000 --> 00:00:20,000
Uh, there'll be lot of different, different inbuilt functions that will be available in those packages

9
00:00:20,000 --> 00:00:23,000
so that you don't even have to write the code completely from scratch.

10
00:00:23,000 --> 00:00:23,000
Right.

11
00:00:23,000 --> 00:00:28,000
So just by using this modules and packages, uh, you can actually use the functions that are available

12
00:00:28,000 --> 00:00:31,000
over there and quickly write down the code.

13
00:00:31,000 --> 00:00:31,000
Right.

14
00:00:31,000 --> 00:00:34,000
So here uh, modules and packages helps organize and reuse the code.

15
00:00:34,000 --> 00:00:39,000
So let me just show you, uh, and let me talk about some of the important modules that we specifically

16
00:00:39,000 --> 00:00:39,000
use.

17
00:00:39,000 --> 00:00:41,000
And there are a lot of modules over there.

18
00:00:41,000 --> 00:00:46,000
And as you will be seeing as I will be probably going ahead with more tutorials, you'll be seeing different

19
00:00:46,000 --> 00:00:47,000
different packages that I will be using.

20
00:00:47,000 --> 00:00:51,000
So first of all, I would like to show you how do we import a package.

21
00:00:51,000 --> 00:00:52,000
Right.

22
00:00:52,000 --> 00:00:53,000
So this math Right.

23
00:00:53,000 --> 00:00:55,000
So let's say I'm importing math.

24
00:00:55,000 --> 00:00:58,000
This math is just like a package or a module.

25
00:00:58,000 --> 00:01:01,000
And inside this I'll just say that this is a package.

26
00:01:01,000 --> 00:01:06,000
And inside this you have a lot of inbuilt functions, specifically mathematical operations that you

27
00:01:06,000 --> 00:01:07,000
really want to do.

28
00:01:07,000 --> 00:01:09,000
Um it will be available over here.

29
00:01:09,000 --> 00:01:15,000
So in order to import any package we just need to go ahead and write import and that the package name

30
00:01:15,000 --> 00:01:15,000
okay.

31
00:01:15,000 --> 00:01:20,000
And uh, let's say if this package is not installed, that we then we have to properly install this

32
00:01:20,000 --> 00:01:21,000
particular package.

33
00:01:21,000 --> 00:01:21,000
Okay.

34
00:01:21,000 --> 00:01:22,000
I'll show you one of the example.

35
00:01:22,000 --> 00:01:24,000
Let's say that I want to use numpy.

36
00:01:24,000 --> 00:01:26,000
NumPy is an amazing package which works with array.

37
00:01:26,000 --> 00:01:29,000
I'll show you how to install it and probably go ahead, you know.

38
00:01:29,000 --> 00:01:31,000
So here I have imported math.

39
00:01:31,000 --> 00:01:33,000
Now math has a lot of inbuilt function.

40
00:01:33,000 --> 00:01:36,000
Let's say I'll go ahead and write math s q r t.

41
00:01:36,000 --> 00:01:40,000
So this is uh basically a function which will do the square root of a number.

42
00:01:40,000 --> 00:01:45,000
So if I give the number over here and if I execute it here, you'll be able to see that I'm able to

43
00:01:45,000 --> 00:01:46,000
get the square root of 16.

44
00:01:46,000 --> 00:01:47,000
Okay.

45
00:01:47,000 --> 00:01:52,000
Similarly, uh, you'll be seeing I will have different different functions inside math.

46
00:01:52,000 --> 00:01:52,000
Right.

47
00:01:52,000 --> 00:01:54,000
Let's say I want to use square root also.

48
00:01:54,000 --> 00:01:54,000
Right.

49
00:01:54,000 --> 00:01:57,000
So how do I import square root function.

50
00:01:57,000 --> 00:01:58,000
Uh from this particular package.

51
00:01:58,000 --> 00:02:02,000
So I can just go ahead and right from the package name.

52
00:02:02,000 --> 00:02:02,000
Right.

53
00:02:02,000 --> 00:02:09,000
So let's say from math import numpy import s q r t.

54
00:02:09,000 --> 00:02:13,000
And let's say I want to use one more function that is available inside math.

55
00:02:13,000 --> 00:02:14,000
So it will be pi okay.

56
00:02:14,000 --> 00:02:17,000
So there are two functions that are available inside math okay.

57
00:02:17,000 --> 00:02:20,000
And if you want to probably go ahead and check it out you can just go ahead.

58
00:02:20,000 --> 00:02:20,000
Right.

59
00:02:20,000 --> 00:02:21,000
Math dot.

60
00:02:21,000 --> 00:02:26,000
And these are all the inbuilt functions that are available uh with respect to this particular package.

61
00:02:26,000 --> 00:02:27,000
Right.

62
00:02:27,000 --> 00:02:27,000
Math dot.

63
00:02:27,000 --> 00:02:29,000
And here you will be able to see it okay.

64
00:02:29,000 --> 00:02:32,000
So let's say uh I want to use the square root of pi.

65
00:02:32,000 --> 00:02:35,000
So I've imported both this functionalities over here.

66
00:02:35,000 --> 00:02:39,000
Now I can directly call this functionality or call this function.

67
00:02:39,000 --> 00:02:41,000
So I will just go ahead and write a script.

68
00:02:41,000 --> 00:02:44,000
Let's say I want the square root of 16.

69
00:02:44,000 --> 00:02:50,000
And then I want the square root of 25 let's say.

70
00:02:50,000 --> 00:02:55,000
Or I want also to probably print, you know, what is the pi value.

71
00:02:55,000 --> 00:02:55,000
Okay.

72
00:02:55,000 --> 00:02:58,000
So pi everybody knows how much is the value right.

73
00:02:58,000 --> 00:02:59,000
3.142.

74
00:02:59,000 --> 00:03:03,000
So if I go ahead and execute over here you'll be able to see square root of 16 is four, square root

75
00:03:03,000 --> 00:03:04,000
of 25 is five.

76
00:03:04,000 --> 00:03:07,000
And uh pi is definitely 3.141.

77
00:03:07,000 --> 00:03:12,000
So similarly in every packages you may be having multiple functions which you can directly use it.

78
00:03:12,000 --> 00:03:17,000
And in order to import it, you just need to remember this particular keyword from the package name.

79
00:03:17,000 --> 00:03:21,000
Import any function that you want that is available in that particular package.

80
00:03:21,000 --> 00:03:21,000
Okay.

81
00:03:21,000 --> 00:03:24,000
Now let's say that you don't have a package right now.

82
00:03:24,000 --> 00:03:26,000
Let's say there is one more package which is called as numpy.

83
00:03:26,000 --> 00:03:28,000
So I will go ahead and use numpy.

84
00:03:28,000 --> 00:03:31,000
I will talk more about numpy as we go ahead in the upcoming session.

85
00:03:31,000 --> 00:03:33,000
So there will be a detailed video on numpy and pandas.

86
00:03:33,000 --> 00:03:38,000
NumPy is specifically a library that will be used whenever you want to create arrays.

87
00:03:38,000 --> 00:03:43,000
You want to apply different operation with respect to the arrays so that where this particular package

88
00:03:43,000 --> 00:03:44,000
will be used.

89
00:03:44,000 --> 00:03:49,000
So if I am using numpy, let's say I'll go ahead and write import numpy as np.

90
00:03:49,000 --> 00:03:53,000
Now what this NP is NP is nothing, but it is an alias.

91
00:03:53,000 --> 00:03:54,000
Okay, alias.

92
00:03:54,000 --> 00:03:57,000
I don't even have to write every time numpy dot.

93
00:03:57,000 --> 00:04:01,000
You know, I can directly use np dot so that my code.

94
00:04:01,000 --> 00:04:03,000
I don't have to completely write the entire package name, you know.

95
00:04:03,000 --> 00:04:06,000
So that is where we specifically use the alias.

96
00:04:06,000 --> 00:04:10,000
Now let's say that I am importing this and if I import this I'm getting an error.

97
00:04:10,000 --> 00:04:13,000
No module named numpy, because obviously I have not installed numpy.

98
00:04:13,000 --> 00:04:19,000
When you create an environment by default, uh, in Python, a virtual environment, some of the packages,

99
00:04:19,000 --> 00:04:23,000
some of the modules will get uh, installed, but not every module will get installed.

100
00:04:23,000 --> 00:04:23,000
Right.

101
00:04:23,000 --> 00:04:27,000
So let's say that I want to probably go ahead and import numpy.

102
00:04:27,000 --> 00:04:29,000
Uh, and for that I need to install.

103
00:04:29,000 --> 00:04:34,000
So what I will do in the requirement dot txt I will go ahead and write numpy okay and I will save this.

104
00:04:34,000 --> 00:04:34,000
Okay.

105
00:04:34,000 --> 00:04:36,000
Now I will go to my terminal.

106
00:04:36,000 --> 00:04:36,000
Okay.

107
00:04:36,000 --> 00:04:39,000
Now let me just go ahead and show you in my terminal.

108
00:04:39,000 --> 00:04:43,000
So my terminal will be over here and I am in my command prompt.

109
00:04:43,000 --> 00:04:45,000
I am inside my Python basic.

110
00:04:45,000 --> 00:04:49,000
So I will go CD dot dot I will go back because this is entirely this requirement.

111
00:04:49,000 --> 00:04:53,000
Dot txt is present in this Python folder right now.

112
00:04:53,000 --> 00:04:58,000
I'll go ahead and write pip install minus r requirements.txt.

113
00:04:58,000 --> 00:05:03,000
This is one way that I can directly write, or I can also go ahead and write pip install numpy.

114
00:05:03,000 --> 00:05:08,000
Okay, so if I go ahead and install pip install numpy you'll be able to see that hey, my installation

115
00:05:08,000 --> 00:05:14,000
will start taking place and this will basically get installed in my venv environment.

116
00:05:14,000 --> 00:05:14,000
Okay.

117
00:05:14,000 --> 00:05:17,000
So this is how uh, things you basically do.

118
00:05:17,000 --> 00:05:19,000
And now you can see my numpy has got installed.

119
00:05:19,000 --> 00:05:19,000
Okay.

120
00:05:19,000 --> 00:05:21,000
Now I'll close this okay.

121
00:05:21,000 --> 00:05:23,000
And what I will do I will go again back to my statement.

122
00:05:24,000 --> 00:05:25,000
Now let's go ahead and import this okay.

123
00:05:25,000 --> 00:05:29,000
Now here you'll be able to see that my import is successful okay.

124
00:05:29,000 --> 00:05:33,000
Now let me just show you one simple operation where I will be trying to create an array.

125
00:05:33,000 --> 00:05:35,000
And here I will give one, two three, four.

126
00:05:35,000 --> 00:05:38,000
So if I go ahead and execute I will basically get an array.

127
00:05:38,000 --> 00:05:40,000
We'll discuss more about the numpy.

128
00:05:40,000 --> 00:05:45,000
But since we are just discussing about basic, uh, Python modules and packages, we are discussing

129
00:05:45,000 --> 00:05:49,000
over here right now, this is like there'll be a lot of inbuilt modules.

130
00:05:49,000 --> 00:05:53,000
Okay, let's say from math I want to import every module.

131
00:05:53,000 --> 00:05:53,000
Right.

132
00:05:53,000 --> 00:05:58,000
So what I can do is that I will go ahead and write from math import star.

133
00:05:58,000 --> 00:06:03,000
Star basically means it is importing all the functions that are available in math.

134
00:06:03,000 --> 00:06:03,000
Right?

135
00:06:03,000 --> 00:06:04,000
I don't have to specify.

136
00:06:04,000 --> 00:06:05,000
Right.

137
00:06:05,000 --> 00:06:08,000
Right now I can directly go ahead and call s q r t.

138
00:06:08,000 --> 00:06:09,000
Okay.

139
00:06:09,000 --> 00:06:11,000
Let's say I will go and call security.

140
00:06:11,000 --> 00:06:13,000
So security is an inbuilt function that is available in math.

141
00:06:13,000 --> 00:06:17,000
And since we have then import star automatically I'll be able to see the output.

142
00:06:17,000 --> 00:06:20,000
So here you can see I'm getting the answer as four right.

143
00:06:20,000 --> 00:06:25,000
And similarly I can go ahead and probably print my pi okay.

144
00:06:25,000 --> 00:06:25,000
And up.

145
00:06:25,000 --> 00:06:29,000
Also I will just go ahead and use a print statement.

146
00:06:29,000 --> 00:06:29,000
Okay.

147
00:06:32,000 --> 00:06:33,000
Print statement.

148
00:06:33,000 --> 00:06:35,000
And then we are uploading this.

149
00:06:35,000 --> 00:06:37,000
And here you can just see by import star.

150
00:06:37,000 --> 00:06:42,000
That basically means we are able to access all the functions that are available inside this particular

151
00:06:42,000 --> 00:06:46,000
uh, package or module, which is called as math perfect.

152
00:06:46,000 --> 00:06:50,000
Uh, I hope, uh, you're able to understand till here there are different different libraries that

153
00:06:50,000 --> 00:06:52,000
we'll be seeing when we'll be doing the coding.

154
00:06:52,000 --> 00:06:56,000
But just get an idea in this particular video, what I'm actually trying to show you is that how do

155
00:06:56,000 --> 00:07:02,000
you import a package or a module, a inbuilt module that is already available in with packages that

156
00:07:02,000 --> 00:07:05,000
are already available, like math, numpy?

157
00:07:05,000 --> 00:07:09,000
If there is no number, if there is no library as such, you can probably install it.

158
00:07:09,000 --> 00:07:09,000
Okay.

159
00:07:10,000 --> 00:07:14,000
Now the most important thing how do I probably create my own custom package?

160
00:07:14,000 --> 00:07:15,000
Okay.

161
00:07:15,000 --> 00:07:18,000
Now let me show you one thing over here okay.

162
00:07:19,000 --> 00:07:21,000
Let me just go ahead and create one folder.

163
00:07:21,000 --> 00:07:23,000
And this will basically be my package.

164
00:07:23,000 --> 00:07:27,000
Now let's say that this is my source code that I'm going to write.

165
00:07:27,000 --> 00:07:27,000
Okay.

166
00:07:27,000 --> 00:07:30,000
I want to define my own custom.

167
00:07:31,000 --> 00:07:36,000
Uh, you can basically say custom module or custom package, which I should be able to call in any other

168
00:07:36,000 --> 00:07:37,000
files.

169
00:07:37,000 --> 00:07:37,000
Okay.

170
00:07:37,000 --> 00:07:40,000
Because here you can see that I'm importing math.

171
00:07:40,000 --> 00:07:40,000
Right.

172
00:07:40,000 --> 00:07:43,000
And this math may be available somewhere, right.

173
00:07:43,000 --> 00:07:45,000
It is available in our V and V environment.

174
00:07:45,000 --> 00:07:48,000
All the packages are available and we are importing from there right now.

175
00:07:48,000 --> 00:07:51,000
Similarly, I can also go ahead and create my own custom things.

176
00:07:51,000 --> 00:07:51,000
Right.

177
00:07:51,000 --> 00:07:53,000
So let's first of all start.

178
00:07:53,000 --> 00:07:54,000
So let's say this is my package folder.

179
00:07:54,000 --> 00:07:57,000
And here I'm going to create some modules.

180
00:07:57,000 --> 00:08:02,000
So first file that you actually require in this is init underscore underscore init.py okay.

181
00:08:03,000 --> 00:08:10,000
So this.py file why this init uh underscore underscore init.py is a it is a special file.

182
00:08:10,000 --> 00:08:10,000
Okay.

183
00:08:10,000 --> 00:08:14,000
So here I'll just go ahead and write a comment for you so that you will be able to understand okay.

184
00:08:14,000 --> 00:08:20,000
So this is a special file okay init underscore underscore p y.

185
00:08:20,000 --> 00:08:24,000
Or let me just use a multi line okay.

186
00:08:24,000 --> 00:08:28,000
And I will go and use this.

187
00:08:29,000 --> 00:08:32,000
See this okay I will close it over here.

188
00:08:33,000 --> 00:08:38,000
Now this init underscore underscore underscore init dot uh underscore underscore dot pi is a special

189
00:08:38,000 --> 00:08:42,000
file used in Python to define packages and initialize the namespace.

190
00:08:42,000 --> 00:08:43,000
Okay.

191
00:08:43,000 --> 00:08:45,000
So let's say that I have actually created this.

192
00:08:45,000 --> 00:08:48,000
Now let me just go ahead and create any file that I want.

193
00:08:48,000 --> 00:08:54,000
Let's say I will just go ahead and write, uh, you know, um, one operation or let's say that I am

194
00:08:54,000 --> 00:08:55,000
creating a calculator.

195
00:08:55,000 --> 00:08:58,000
And so here my maths dot pi file is there.

196
00:08:58,000 --> 00:08:58,000
Okay.

197
00:08:58,000 --> 00:09:02,000
Now inside this maths dot pi file what I will do I will just go ahead and define a function.

198
00:09:02,000 --> 00:09:07,000
Let's say I'm going to write definition addition a comma b okay.

199
00:09:07,000 --> 00:09:12,000
So what this function basically does is that we are just going to return a plus b okay.

200
00:09:12,000 --> 00:09:17,000
We know that in math also write some operation is also the inbuilt sum operation is there.

201
00:09:17,000 --> 00:09:19,000
But I'm just trying to show you.

202
00:09:19,000 --> 00:09:23,000
So inside this package you will be able to see that math dot pi file is there.

203
00:09:23,000 --> 00:09:26,000
And inside that there is a function which is called as addition.

204
00:09:26,000 --> 00:09:33,000
Now very important thing that you really need to understand over here this package folder dot math.

205
00:09:33,000 --> 00:09:34,000
Right.

206
00:09:34,000 --> 00:09:35,000
It becomes our module.

207
00:09:35,000 --> 00:09:36,000
Right.

208
00:09:36,000 --> 00:09:38,000
Since we are using this underscore underscore init dot pi.

209
00:09:38,000 --> 00:09:45,000
And always remember inside a folder, if you want to initialize this entire folder and define packages

210
00:09:45,000 --> 00:09:50,000
right or define modules, you have to probably use underscore underscore init.py even though it is empty.

211
00:09:50,000 --> 00:09:51,000
Just keep it empty.

212
00:09:51,000 --> 00:09:52,000
But you need to have this file.

213
00:09:52,000 --> 00:09:57,000
Now I'll show you how I will call this particular function by importing this right from this particular

214
00:09:57,000 --> 00:09:58,000
package.

215
00:09:58,000 --> 00:10:00,000
Okay, now this is my entire package.

216
00:10:00,000 --> 00:10:02,000
Now I'll go back to my import dot Ipynb.

217
00:10:02,000 --> 00:10:06,000
Now here I will go ahead and write from packages.

218
00:10:06,000 --> 00:10:06,000
Right.

219
00:10:06,000 --> 00:10:09,000
So see from package I'm getting dot.

220
00:10:09,000 --> 00:10:10,000
What is my file name.

221
00:10:10,000 --> 00:10:11,000
Maths.

222
00:10:11,000 --> 00:10:12,000
Right.

223
00:10:12,000 --> 00:10:15,000
Import right from package dot math.

224
00:10:15,000 --> 00:10:18,000
See from package dot math.

225
00:10:18,000 --> 00:10:21,000
And remember this needs to be in the same folder location.

226
00:10:21,000 --> 00:10:22,000
Then only you'll be able to call it right.

227
00:10:22,000 --> 00:10:25,000
So from package dot math right.

228
00:10:25,000 --> 00:10:29,000
Dot math is basically this folder I'm going to import addition.

229
00:10:29,000 --> 00:10:31,000
So let me just go ahead and copy this.

230
00:10:31,000 --> 00:10:35,000
And here you'll be able to see I will just go ahead and copy this right now.

231
00:10:35,000 --> 00:10:39,000
After calling this I can just go ahead and call this function right.

232
00:10:39,000 --> 00:10:41,000
And here I can give two comma three.

233
00:10:41,000 --> 00:10:45,000
And if I execute it, you'll be able to see that I'm actually able to get the output.

234
00:10:45,000 --> 00:10:48,000
So I hope you are getting an idea right.

235
00:10:48,000 --> 00:10:51,000
How do you probably create your own custom module.

236
00:10:51,000 --> 00:10:51,000
Right.

237
00:10:51,000 --> 00:10:55,000
And from package dot maths how I am importing addition.

238
00:10:55,000 --> 00:10:55,000
Right.

239
00:10:55,000 --> 00:11:01,000
And uh, if you don't want to write like this okay, let's write it in another way from package.

240
00:11:01,000 --> 00:11:02,000
Uh, import math.

241
00:11:02,000 --> 00:11:04,000
I can also write like this.

242
00:11:04,000 --> 00:11:06,000
Okay, I import math.

243
00:11:06,000 --> 00:11:10,000
Now, in order to call this, I can go ahead and write maths dot addition.

244
00:11:10,000 --> 00:11:11,000
Okay.

245
00:11:11,000 --> 00:11:13,000
And here I can call two comma three.

246
00:11:13,000 --> 00:11:13,000
Right.

247
00:11:13,000 --> 00:11:19,000
So this how you can probably create any number of files inside this particular package folder.

248
00:11:19,000 --> 00:11:19,000
Right.

249
00:11:19,000 --> 00:11:22,000
Since I have underscore underscore underscore underscore dot pi.

250
00:11:22,000 --> 00:11:26,000
When I create only this file then only this becomes a package or a module.

251
00:11:26,000 --> 00:11:26,000
Right.

252
00:11:26,000 --> 00:11:29,000
And then I can actually call this anywhere that I want.

253
00:11:29,000 --> 00:11:31,000
I can build my own custom function.

254
00:11:31,000 --> 00:11:33,000
I can build any number of custom function.

255
00:11:33,000 --> 00:11:38,000
Let's say I'll go ahead and write definition subtraction subtraction.

256
00:11:38,000 --> 00:11:40,000
And here I'll give a comma B.

257
00:11:40,000 --> 00:11:47,000
And uh let me just go ahead and write return a, return a minus b.

258
00:11:47,000 --> 00:11:53,000
So once I have updated subtraction, you know, so what I will do I will let me just show you how to

259
00:11:53,000 --> 00:11:59,000
call C in Ipy and B obviously you know how to call it right by just importing addition maths, whatever

260
00:11:59,000 --> 00:12:00,000
things you specifically require.

261
00:12:00,000 --> 00:12:05,000
But uh, mainly when we are developing projects, we have to call all these files in some py file.

262
00:12:05,000 --> 00:12:07,000
So let me just go ahead and create one more py file.

263
00:12:07,000 --> 00:12:11,000
And here I will just go ahead and write test.py okay.

264
00:12:11,000 --> 00:12:13,000
Uh test.py already exist.

265
00:12:13,000 --> 00:12:14,000
Let me just check.

266
00:12:14,000 --> 00:12:15,000
Okay.

267
00:12:15,000 --> 00:12:18,000
Uh, here we will create, uh, test dot p y.

268
00:12:18,000 --> 00:12:20,000
So test dot p y is over here.

269
00:12:20,000 --> 00:12:23,000
Now, in this test dot p y, I will try to call from this particular package.

270
00:12:23,000 --> 00:12:24,000
So how do I call it.

271
00:12:24,000 --> 00:12:29,000
So here I will write from package dot maths okay.

272
00:12:29,000 --> 00:12:32,000
Import star okay.

273
00:12:32,000 --> 00:12:35,000
Now what I can do I can basically call my addition.

274
00:12:35,000 --> 00:12:38,000
So I will go ahead and write print Addition.

275
00:12:39,000 --> 00:12:41,000
And here I'm going to say two comma three.

276
00:12:41,000 --> 00:12:43,000
And let me just go ahead and write print.

277
00:12:44,000 --> 00:12:49,000
Subtraction with three comma four okay.

278
00:12:49,000 --> 00:12:51,000
Or four comma three okay.

279
00:12:51,000 --> 00:12:57,000
Now I will just go ahead and show you how to execute this so I can directly execute dot pi file.

280
00:12:57,000 --> 00:13:00,000
Always make sure you have to be inside this folder itself.

281
00:13:00,000 --> 00:13:06,000
Write this five modules if you want to execute any test.py file, like any py file, you have to make

282
00:13:06,000 --> 00:13:08,000
sure that you have to go to that folder location and run it.

283
00:13:08,000 --> 00:13:13,000
So here I will go just go to CD five modules okay.

284
00:13:13,000 --> 00:13:17,000
Now in order to execute it I will write Python test.py.

285
00:13:18,000 --> 00:13:20,000
Now see here I am able to get an answer for addition.

286
00:13:20,000 --> 00:13:23,000
I'm getting two comma three for subtraction I'm getting one.

287
00:13:23,000 --> 00:13:28,000
Okay, so uh, this was just an idea where I've actually created the packages.

288
00:13:28,000 --> 00:13:32,000
My own custom packages, math.py file, any number of function that I want to.

289
00:13:32,000 --> 00:13:35,000
And I've shown you how to call it in ipynb file.

290
00:13:35,000 --> 00:13:38,000
Along with that I will also have shown you how to call it in test.py file.

291
00:13:39,000 --> 00:13:46,000
So uh, this in short talks about, uh, you know, uh, the most important thing that how an import

292
00:13:46,000 --> 00:13:47,000
is basically done.

293
00:13:47,000 --> 00:13:48,000
Right.

294
00:13:48,000 --> 00:13:55,000
Uh, we'll also talk about one important thing, uh, which is called as uh sub uh sub package uh imports.

295
00:13:55,000 --> 00:13:55,000
Okay.

296
00:13:55,000 --> 00:14:00,000
And uh with respect to sub package imports, uh, the thing is that let's say that okay, I have this

297
00:14:00,000 --> 00:14:01,000
packages.

298
00:14:01,000 --> 00:14:01,000
Okay.

299
00:14:02,000 --> 00:14:04,000
Now let me just show you one more thing.

300
00:14:04,000 --> 00:14:05,000
Okay.

301
00:14:05,000 --> 00:14:06,000
I have this packages.

302
00:14:06,000 --> 00:14:09,000
Now I will click this I will create one more folder okay.

303
00:14:09,000 --> 00:14:13,000
And this sorry inside my packages.

304
00:14:13,000 --> 00:14:15,000
Inside my packages okay.

305
00:14:15,000 --> 00:14:16,000
So so this is my package folder.

306
00:14:16,000 --> 00:14:17,000
I'll create one more folder.

307
00:14:17,000 --> 00:14:19,000
Sub packages.

308
00:14:19,000 --> 00:14:20,000
Okay.

309
00:14:20,000 --> 00:14:25,000
Now if I also want to make this as a package and probably call it somewhere here.

310
00:14:25,000 --> 00:14:30,000
Also I have to use underscore underscore init underscore underscore dot pi file.

311
00:14:30,000 --> 00:14:30,000
Okay.

312
00:14:30,000 --> 00:14:33,000
Now I can go ahead and create any operation that I want.

313
00:14:33,000 --> 00:14:37,000
Let's say I want to probably go ahead and write math dot pi okay.

314
00:14:37,000 --> 00:14:39,000
Now math dot pi is nothing.

315
00:14:39,000 --> 00:14:45,000
but, uh, we'll specifically be using this, uh, let's say, uh, instead of math, I'll just use

316
00:14:45,000 --> 00:14:51,000
some other file name so that we'll be able to distinguish it, let's say mult dot pi.

317
00:14:51,000 --> 00:14:57,000
So this package is responsible in, you know, performing any multiplication operation.

318
00:14:57,000 --> 00:15:02,000
So let's say I will go ahead and define my function and I'll say hey this is my multiply here I'm going

319
00:15:02,000 --> 00:15:04,000
to give a comma B.

320
00:15:04,000 --> 00:15:09,000
and this is basically going to return a star b I know the functions are very simple, but the core idea

321
00:15:09,000 --> 00:15:11,000
is to understand how to call all these packages.

322
00:15:11,000 --> 00:15:14,000
Now perfect this mult dot pi is present inside the sub package.

323
00:15:14,000 --> 00:15:19,000
Now what I will do in my test dot pi I will try to call this particular package.

324
00:15:19,000 --> 00:15:20,000
Okay.

325
00:15:20,000 --> 00:15:21,000
Now it will be interesting.

326
00:15:21,000 --> 00:15:33,000
So here you will be able to see from from package okay Dot maths dot dot sub package okay.

327
00:15:33,000 --> 00:15:33,000
Sorry.

328
00:15:33,000 --> 00:15:38,000
From package dot sub package dot mult.

329
00:15:38,000 --> 00:15:43,000
Okay I'm going to import my multiply function.

330
00:15:43,000 --> 00:15:45,000
See how step by step we went.

331
00:15:45,000 --> 00:15:47,000
So packages first there were packages.

332
00:15:47,000 --> 00:15:49,000
Then we went to sub packages.

333
00:15:49,000 --> 00:15:50,000
Then we called this mul dot p y.

334
00:15:50,000 --> 00:15:55,000
And remember we are only able to identify it unless and until this underscore underscore innit dot p

335
00:15:55,000 --> 00:15:56,000
y file is present or not.

336
00:15:57,000 --> 00:16:02,000
If this particular file is present then this makes this particular folder as a package okay by default.

337
00:16:02,000 --> 00:16:09,000
So now let me just go ahead and call this over here and let me go ahead and print my multiplication.

338
00:16:09,000 --> 00:16:15,000
So here I will be calling my multiply function with five four comma five.

339
00:16:15,000 --> 00:16:18,000
Now if I just want to execute it, how do I execute it?

340
00:16:18,000 --> 00:16:22,000
I'll just go ahead and write Python test.py.

341
00:16:22,000 --> 00:16:23,000
Okay.

342
00:16:23,000 --> 00:16:27,000
So here you can see initially I got five one and 20 right.

343
00:16:27,000 --> 00:16:33,000
So addition uh three plus two is five four minus three is one and four uh multiplied by five is 20.

344
00:16:33,000 --> 00:16:36,000
So I hope, uh, you got this specific idea.

345
00:16:36,000 --> 00:16:39,000
I hope you are able to understand about packages and all.

346
00:16:39,000 --> 00:16:43,000
Um, this was, uh, it from my side.

347
00:16:43,000 --> 00:16:48,000
Uh, and here I've shown you both the things how to call default packages that are open source packages

348
00:16:48,000 --> 00:16:50,000
that are already available.

349
00:16:50,000 --> 00:16:50,000
Right.

350
00:16:50,000 --> 00:16:54,000
So I've actually used this numpy math and all.

351
00:16:54,000 --> 00:16:59,000
And the second thing that I have actually shown you how to call any other packages that are available

352
00:16:59,000 --> 00:17:02,000
in any other folders or functions that you are probably defining.

353
00:17:02,000 --> 00:17:04,000
So yes, this was it for my side.

354
00:17:04,000 --> 00:17:05,000
I will see you all in the next video.

355
00:17:05,000 --> 00:17:06,000
Thank you.

356
00:17:06,000 --> 00:17:06,000
Take.

