1
00:00:00,000 --> 00:00:09,000
In this video, you'll learn about modules and packages.

2
00:00:09,000 --> 00:00:12,000
A module is a file that contains code.

3
00:00:12,000 --> 00:00:16,000
So here we see a module with the name greeting.py.

4
00:00:16,000 --> 00:00:19,000
It defines a function sayHello,

5
00:00:19,000 --> 00:00:21,000
and it uses the sayHello name,

6
00:00:21,000 --> 00:00:25,000
and it returns a hello followed by a name,

7
00:00:25,000 --> 00:00:28,000
where the name is a variable that will be used.

8
00:00:28,000 --> 00:00:30,000
And you can use it in another file,

9
00:00:30,000 --> 00:00:33,000
as in import greeting, which will import the module,

10
00:00:33,000 --> 00:00:36,000
and then you use print greeting,

11
00:00:36,000 --> 00:00:37,000
which is the name of the module,

12
00:00:37,000 --> 00:00:39,000
dot sayHello,

13
00:00:39,000 --> 00:00:40,000
and for instance,

14
00:00:40,000 --> 00:00:43,000
which is the name that you want to print then.

15
00:00:43,000 --> 00:00:45,000
Now we have a package.

16
00:00:45,000 --> 00:00:48,000
A package is a complete directory that contains modules

17
00:00:48,000 --> 00:00:53,000
and an __init__.py file.

18
00:00:53,000 --> 00:00:57,000
Functions from the modules in a package can be imported in code

19
00:00:57,000 --> 00:01:02,000
using from package dot module one import my function.

20
00:01:02,000 --> 00:01:07,000
And using packages makes it easier to implement standardization.

21
00:01:07,000 --> 00:01:11,000
Packages are also one of the reasons behind the success of Python,

22
00:01:11,000 --> 00:01:14,000
because it is what makes Python easily extensible.

