1
00:00:00,360 --> 00:00:01,560
Hello, dear friends.

2
00:00:02,370 --> 00:00:09,090
So in this lesson, we're going to try to understand what module's mean and what's the logic in this

3
00:00:09,090 --> 00:00:09,570
regard.

4
00:00:09,930 --> 00:00:11,220
OK, so let's start.

5
00:00:13,030 --> 00:00:14,680
What are modules, anyway?

6
00:00:15,790 --> 00:00:23,440
Well, just simply put, a module is a file consisting of python code, a module can define functions,

7
00:00:23,440 --> 00:00:25,000
classes and variables.

8
00:00:25,870 --> 00:00:28,990
Module can also include runnable code.

9
00:00:30,410 --> 00:00:32,000
So why do we need to use it?

10
00:00:32,570 --> 00:00:37,700
I think you can guess it a couple of things, but I want to tell you that by integrating a Python module

11
00:00:37,700 --> 00:00:44,210
into our program, we can use it from functions and classes written inside the modules and then write

12
00:00:44,210 --> 00:00:46,370
our programs way more effectively.

13
00:00:47,740 --> 00:00:53,620
So without the concept of a module, we would have to write each function and class in our programs

14
00:00:53,620 --> 00:00:54,230
ourselves.

15
00:00:56,510 --> 00:00:57,920
So how do we use it?

16
00:00:57,950 --> 00:01:01,880
Yes, the 20000 coin question.

17
00:01:03,200 --> 00:01:10,700
So the import statement that's going to allow us to use any python source file as a module in another

18
00:01:10,880 --> 00:01:13,730
python source file, you see where we're going with this.

19
00:01:15,050 --> 00:01:19,670
When the interpreter encounters an import statement, it imports the module.

20
00:01:19,760 --> 00:01:26,720
If the module is present in the search path and a search path is a list of directories that the interpreter

21
00:01:26,720 --> 00:01:30,320
searches for before importing a module.

22
00:01:31,440 --> 00:01:35,250
OK, I get it, I get it, but how many times do we need to call up a module?

23
00:01:36,130 --> 00:01:42,130
Well, a module is only loaded once, regardless of the number of times that it is imported.

24
00:01:43,060 --> 00:01:48,940
So this prevents the module execution from happening over and over again if multiple imports occur.

25
00:01:50,810 --> 00:01:54,710
Now, what about ready made modules in the Python library?

26
00:01:55,100 --> 00:01:55,790
Aha.

27
00:01:55,940 --> 00:02:01,520
Now we're getting to it by then has a number of Ready-Made modules written by Python developers.

28
00:02:02,300 --> 00:02:03,290
It's also in our code.

29
00:02:03,290 --> 00:02:09,860
We can use many modules that programmers upload to the Internet and GitHub, and we can write well,

30
00:02:10,160 --> 00:02:13,970
just more beautiful programs in a much more time efficient manner.

31
00:02:15,950 --> 00:02:17,120
You want to see some examples.

32
00:02:17,420 --> 00:02:18,140
I know you do.

33
00:02:18,950 --> 00:02:27,080
So let's import one readymade module in Python called the math module for this import math, and we

34
00:02:27,080 --> 00:02:29,600
import the math module into our project.

35
00:02:30,350 --> 00:02:32,720
We can use all the math functions now.

36
00:02:34,980 --> 00:02:39,360
So now we can see the inside of the math module with the dirt method.

37
00:02:40,690 --> 00:02:43,810
And let's have a look and see what's inside that math module.

38
00:02:45,070 --> 00:02:45,730
Math.

39
00:02:49,320 --> 00:02:51,210
And now we can see all the math functions.

40
00:02:52,350 --> 00:02:55,290
So as you can see, there are way too many functions in it.

41
00:03:02,150 --> 00:03:06,440
Also, if you want to know what they do, we can type help math.

42
00:03:09,600 --> 00:03:13,230
Now we can see all the math functions and their tasks.

43
00:03:17,530 --> 00:03:21,040
Also, we can see each function and its task individually.

44
00:03:21,370 --> 00:03:22,480
So that's what we need to do.

45
00:03:22,510 --> 00:03:25,600
Just type help map function name like factorial.

46
00:03:32,890 --> 00:03:39,820
Now, pythons from statement letters import specific attributes from a module into the current namespace.

47
00:03:40,390 --> 00:03:42,700
But first, we need to reset the kernel.

48
00:03:43,950 --> 00:03:45,990
Is it going to lose previous import function?

49
00:03:47,280 --> 00:03:50,010
And let's check and see if the colonel has been reset.

50
00:03:55,180 --> 00:03:56,080
And it has.

51
00:03:58,030 --> 00:04:02,740
So now time for -- math, import a module name like floor.

52
00:04:08,790 --> 00:04:10,710
And yeah, let's use the floor function.

53
00:04:12,180 --> 00:04:13,140
Eight dot seven.

54
00:04:19,800 --> 00:04:20,640
The result is eight.

55
00:04:21,790 --> 00:04:26,080
Also, if you want to know what they do, we can type help math.

56
00:04:28,070 --> 00:04:28,640
Floor.

57
00:04:34,070 --> 00:04:36,520
We get an error because we didn't imported.

58
00:04:41,450 --> 00:04:41,870
Help.

59
00:04:43,590 --> 00:04:44,160
Floor.

60
00:04:47,040 --> 00:04:52,410
So what if we try a different function, SEAL eight point seven?

61
00:05:00,970 --> 00:05:06,580
Cool, so play around with that, because in this lesson, we learned the module's concept in Python

62
00:05:06,790 --> 00:05:08,710
and a few different ways to use it.

63
00:05:09,920 --> 00:05:12,650
Play around with it and I'll see you in the next lesson.

64
00:05:13,400 --> 00:05:14,060
Have a good day.
