1 00:00:07,610 --> 00:00:15,590 Now, the final, very important way to structure your report and make it more useful when using Python 2 00:00:15,920 --> 00:00:22,400 is by adding modules and modules are basically different files that hold all your functions. 3 00:00:22,610 --> 00:00:23,750 So we remain the file. 4 00:00:23,990 --> 00:00:27,380 Don't need to have any additional functions, is there? 5 00:00:27,530 --> 00:00:31,410 And you can simply import just modules inside your main file. 6 00:00:31,640 --> 00:00:34,190 So I will show you how this looks like in real life. 7 00:00:34,790 --> 00:00:40,460 Now let's say you have the length in centimeters and you want to convert it in meters. 8 00:00:40,730 --> 00:00:43,210 So let's create a function that is doing that. 9 00:00:43,820 --> 00:00:55,100 So T.F. seem to end and will take land as an input here and this whole function will return length divided 10 00:00:55,100 --> 00:00:56,050 by a 100. 11 00:00:56,180 --> 00:01:02,540 So we'll pass the length and centimeters when we divide it by once and we'll get the latest meters and 12 00:01:02,550 --> 00:01:04,250 let's create the opposite. 13 00:01:04,280 --> 00:01:09,250 So Jeff M to see you. 14 00:01:09,920 --> 00:01:19,120 And then again, let's now let's try return length multiplied by 100 so it's percent one metre will 15 00:01:19,130 --> 00:01:22,730 multiplied by 100 to get the value in centimeters. 16 00:01:23,090 --> 00:01:30,530 OK, but what they want now is to use this function also outside of this file because that's the lesser 17 00:01:30,580 --> 00:01:31,030 to me. 18 00:01:31,070 --> 00:01:32,200 I would like less, less. 19 00:01:32,240 --> 00:01:38,300 And like you mentioned, you could get functions that are two lines of code that's would it feasible 20 00:01:38,300 --> 00:01:40,070 and possible in Python. 21 00:01:40,370 --> 00:01:47,690 So what we are doing in that case, I will go here to my project and I'll double click and create the 22 00:01:47,690 --> 00:01:53,830 new high def module and I will write a name in the name will be Convert. 23 00:01:54,680 --> 00:01:57,070 Let's finish here, OK? 24 00:01:57,200 --> 00:02:01,670 And you can see that now we are getting a convert file inside your package. 25 00:02:02,240 --> 00:02:03,080 Sort this out. 26 00:02:04,190 --> 00:02:10,880 So basically the modules the user need to be outside the packages in order to get the support from everywhere. 27 00:02:11,210 --> 00:02:13,090 So now we'll just convert. 28 00:02:13,370 --> 00:02:14,670 It doesn't care anything. 29 00:02:14,900 --> 00:02:21,410 So I will simply cook this line of code and place it into the convert package and see it. 30 00:02:21,680 --> 00:02:31,330 Then when we go back to the function, to our main file, then you can add this mentals by simply write 31 00:02:31,340 --> 00:02:35,230 import, then the name of the file. 32 00:02:35,240 --> 00:02:40,160 So convert and we import to the file. 33 00:02:40,670 --> 00:02:43,930 So now we are able to use all the functions from this file. 34 00:02:44,210 --> 00:02:50,900 So you can simply do that by writing convert didn't write the dot and then specify the method. 35 00:02:50,930 --> 00:02:53,300 As you can see, the menus are already proposed here. 36 00:02:53,540 --> 00:02:57,430 So I use centimeter to meter right in here. 37 00:02:57,440 --> 00:03:03,020 I want you to specify the length so I will write 100 centimeters, which would give me one meter. 38 00:03:03,500 --> 00:03:06,620 So let's print this and let's write. 39 00:03:07,340 --> 00:03:09,470 And you can see that the value is one meter. 40 00:03:09,470 --> 00:03:13,100 So property, you will just function nothis located in another file. 41 00:03:13,460 --> 00:03:18,980 Now there was even easier way to use the functions without using the convert worked in front of every 42 00:03:18,980 --> 00:03:19,390 function. 43 00:03:19,580 --> 00:03:28,840 So you can write from then the name of the file convert import and then the name or the function that 44 00:03:28,840 --> 00:03:32,640 you would like to import to import Netiv to something neater. 45 00:03:33,110 --> 00:03:35,420 Now what it can do is simply write. 46 00:03:36,140 --> 00:03:42,500 Meeta assigned Meeta without specifying the convert keyword and then write, let's say, to meet or 47 00:03:42,500 --> 00:03:44,420 select, convert them to centimeters. 48 00:03:44,750 --> 00:03:46,580 Let's bring this in. 49 00:03:46,580 --> 00:03:50,100 You can see that two meters are equal to 200 centimeters. 50 00:03:50,100 --> 00:03:53,550 So successfully used this function, that was from another file. 51 00:03:54,290 --> 00:04:00,920 So that was if everything guys for just section and individual, I really hope that it was helpful for 52 00:04:00,920 --> 00:04:08,330 you and it will help you to understand how to structure your code in Python and industrial ranges, 53 00:04:08,340 --> 00:04:10,500 visual height and give it the like. 54 00:04:10,850 --> 00:04:13,980 I really appreciate that that you spent some time with me. 55 00:04:14,210 --> 00:04:15,560 Thank you very much for watching. 56 00:04:15,560 --> 00:04:17,570 And I'll see you in our next coding.