1
00:00:00,510 --> 00:00:03,540
Hello and welcome to this video.

2
00:00:03,780 --> 00:00:05,400
What are modules.

3
00:00:06,090 --> 00:00:16,650
A python module is basically a python file that can contain various types of objects like functions

4
00:00:17,040 --> 00:00:25,210
global variables list dictionaries and other types of objects.

5
00:00:25,350 --> 00:00:35,430
A module is like a code library creating a module is fairly straightforward or you need to do is create

6
00:00:35,580 --> 00:00:44,370
a python file and then you add whatever objects you want into that file so you can add a function you

7
00:00:44,370 --> 00:00:46,790
can add a dictionary.

8
00:00:46,950 --> 00:00:54,750
You could add a variable and any other types of object you want to include in your module.

9
00:00:54,780 --> 00:00:58,320
So the first thing I'm going to do is create a new python file.

10
00:00:58,560 --> 00:01:05,940
So I'm going to right click on my directory and go new click on python file and I'm going to call this

11
00:01:06,030 --> 00:01:11,830
salute and click Okay.

12
00:01:11,860 --> 00:01:16,010
So now I have created a new python file called Salute.

13
00:01:16,390 --> 00:01:25,050
So what I'm going to add into this file I'm going to add a function and I'm going to add a dictionary

14
00:01:25,870 --> 00:01:31,870
but you can add as many things as you want so you can have several functions that do different things

15
00:01:32,380 --> 00:01:38,440
and order types of data structures depending on what it is you want to include.

16
00:01:38,440 --> 00:01:42,000
So let me start by creating a very simple function.

17
00:01:42,000 --> 00:01:48,660
I'm going to create a function chord C on the score.

18
00:01:48,790 --> 00:01:49,330
Hello.

19
00:01:50,080 --> 00:01:57,430
And I'm going to pass in one parameter which is going to be a name parameter and then I will add my

20
00:01:57,430 --> 00:02:02,590
colon and tab down and I had a print function.

21
00:02:02,620 --> 00:02:10,690
So this is what will execute for that function does the function body and inside the parentheses.

22
00:02:10,690 --> 00:02:26,060
I'm just gonna add a simple text that will say hello comma and then I will add a string which will be

23
00:02:26,540 --> 00:02:37,200
the parameter argument that is supplied for the name parameter.

24
00:02:37,190 --> 00:02:37,510
All right.

25
00:02:37,520 --> 00:02:48,210
So when this is called you supply a name that will be appended to this text.

26
00:02:48,410 --> 00:02:53,120
Next thing I want to do is add a dictionary to this module.

27
00:02:53,150 --> 00:02:54,980
So I'm going to create a dictionary.

28
00:02:54,980 --> 00:03:00,100
So I say fruits and I'll say equals two.

29
00:03:00,470 --> 00:03:09,090
And inside my curly braces I'm going to add a key and then a value.

30
00:03:09,140 --> 00:03:15,230
So the key is going to be called name and the value.

31
00:03:15,470 --> 00:03:27,530
I'm going to give it grapes that's one I do a comma and I'll add another key this time I'll make this

32
00:03:27,530 --> 00:03:36,360
one color and I had the value and give it a value of green.

33
00:03:36,380 --> 00:03:45,380
So this is just a very basic example of how you can create a module so you can have as many things as

34
00:03:45,380 --> 00:03:52,030
you want as many functions as you want different kind of variables on all that kind of data structures

35
00:03:52,040 --> 00:03:56,250
you want to include inside your module.

36
00:03:56,480 --> 00:04:01,250
In this video I introduced you to what modules are.

37
00:04:01,520 --> 00:04:05,270
And we also created a basic module.

38
00:04:05,270 --> 00:04:07,400
Thanks for watching and bye for now.
