1 00:00:12,100 --> 00:00:19,840 Hi, everyone, again, so we have seen several examples regarding OLP, imagine yourselves talking 2 00:00:19,840 --> 00:00:26,710 and saying, I Demitry, you want to stop these examples going because we went over several times, 3 00:00:26,710 --> 00:00:34,930 actually the model of how to create instance of an object, methods of object using in it and using 4 00:00:36,400 --> 00:00:37,800 the self barometer. 5 00:00:37,900 --> 00:00:39,300 And now it's time to practice. 6 00:00:39,320 --> 00:00:44,530 OK, this would conclude the first part off object oriented programming in Python. 7 00:00:44,800 --> 00:00:51,420 Then we're going to see inheritance and so are much more cool stuff regarding object oriented programming. 8 00:00:52,330 --> 00:00:55,420 So let's begin going over the homework assignment. 9 00:00:55,420 --> 00:00:55,690 Right. 10 00:00:56,290 --> 00:01:04,480 So and this assignment, you need to create an object class classes, methods and instances, the whole 11 00:01:04,480 --> 00:01:05,050 shebang. 12 00:01:05,170 --> 00:01:09,620 You will need to use all the tools that you have acquired in the last lectures of this topic. 13 00:01:10,390 --> 00:01:13,210 So these are the instructions of the assignment. 14 00:01:13,630 --> 00:01:21,020 First of all, please create a car class and it's appropriate init method. 15 00:01:21,040 --> 00:01:27,430 Don't forget that any method has two times underscores in each side, not once and only then you will 16 00:01:27,430 --> 00:01:32,530 see the background color of init method colored as a special method. 17 00:01:32,540 --> 00:01:39,600 So we have to underscore in each side and it should receive one list type arguments. 18 00:01:39,610 --> 00:01:39,970 All right. 19 00:01:40,300 --> 00:01:43,180 So eight methods can receive arguments. 20 00:01:43,180 --> 00:01:49,370 And in this init, I wanted to receive one list type argument and this is for that part. 21 00:01:49,570 --> 00:01:53,040 All right, then this great object of an instance. 22 00:01:53,050 --> 00:01:53,440 All right. 23 00:01:53,440 --> 00:01:58,750 So we create two instances, one for Audi A3 and one for Ford Focus. 24 00:01:59,710 --> 00:02:09,060 Then the properties of this instance erm would receive a list which will contain the following variables. 25 00:02:09,110 --> 00:02:13,270 OK, so property section, this part. 26 00:02:13,550 --> 00:02:20,170 OK, this means actually I'm talking here about the content of the method and it each will receive in 27 00:02:20,170 --> 00:02:28,780 one list argument as we just talked about, and basically that list argument would contain the following 28 00:02:29,140 --> 00:02:29,900 information. 29 00:02:29,920 --> 00:02:38,680 OK, so there will be two lists, OK, with these variables inside the lists and here I'm explaining 30 00:02:38,680 --> 00:02:42,800 what each item in the cell would contain. 31 00:02:42,820 --> 00:02:50,100 OK, so the first one is year of release, then current car price the name, then doors closed status. 32 00:02:50,470 --> 00:02:53,140 OK, so we have one for full focus list. 33 00:02:53,440 --> 00:02:57,760 Two thousand five, five thousand for focus and two for the status. 34 00:02:58,000 --> 00:03:00,440 And we have one for Audi A3 as well. 35 00:03:01,480 --> 00:03:02,900 So this is for that part. 36 00:03:03,520 --> 00:03:09,700 So basically you need to create two instances and above each instance, create a list and appropriate 37 00:03:09,700 --> 00:03:10,090 list. 38 00:03:10,300 --> 00:03:13,270 And that's this list should go inside the instance. 39 00:03:13,300 --> 00:03:23,740 OK, this is about this part then could create two, actually three method classes. 40 00:03:24,820 --> 00:03:32,950 The first method should calculate insurance insurance price by using the conditions if the year OK, 41 00:03:33,070 --> 00:03:38,300 if the year off release of the car is between 2010 and 2020. 42 00:03:38,320 --> 00:03:43,090 OK, obviously you need to use this these variables right here. 43 00:03:43,300 --> 00:03:52,360 Once you pass the list into the as a property into the init method, you should use this method and 44 00:03:52,360 --> 00:03:54,900 use these values to calculate it. 45 00:03:55,180 --> 00:04:04,030 So this is the condition of the year of the use is between 2010 and 2020 and the current price is between 46 00:04:04,040 --> 00:04:06,580 six, six grand and seventeen grand. 47 00:04:07,480 --> 00:04:13,890 The insurance will be five percent of the car wharfe, which is this is the car worth. 48 00:04:14,210 --> 00:04:22,960 OK, so you need to calculate this, this insurance price by using the conditions I've stated stated 49 00:04:22,960 --> 00:04:24,310 here inside. 50 00:04:24,340 --> 00:04:24,640 Right. 51 00:04:26,080 --> 00:04:34,600 Then for every other parameter the car would be seven percent of the car's worth the not the car price. 52 00:04:34,600 --> 00:04:36,070 The insurance price actually. 53 00:04:39,730 --> 00:04:40,690 We just fix it. 54 00:04:46,480 --> 00:04:53,980 OK, so this is you have like two, two ifs here and you need to calculate the insurance price by using 55 00:04:54,250 --> 00:04:56,050 these two items here. 56 00:04:57,070 --> 00:05:00,880 All right, following you have another class method door. 57 00:05:00,880 --> 00:05:02,320 Satis is its name. 58 00:05:02,560 --> 00:05:06,390 It will print what whether the doors are closed or not. 59 00:05:06,640 --> 00:05:09,050 The last value of the list indicates it. 60 00:05:09,070 --> 00:05:14,650 It's a it's true means the doors are closed and a false means, meaning they are open. 61 00:05:14,950 --> 00:05:19,810 OK, just print it and you have a third class method. 62 00:05:20,830 --> 00:05:27,310 Please print because these are in the following structure, the car model as Hellblazer variable it 63 00:05:27,310 --> 00:05:28,030 would release. 64 00:05:28,480 --> 00:05:31,540 It was released in the year of OK place here. 65 00:05:31,540 --> 00:05:35,260 The second and its cost base, the third variable here. 66 00:05:35,590 --> 00:05:39,300 Please use a string formatting approach for the print. 67 00:05:39,310 --> 00:05:45,760 OK, we have covered the string formatting in the previous lecture and the live coding example lecture. 68 00:05:45,760 --> 00:05:47,620 I have talked about string formatting. 69 00:05:47,830 --> 00:05:54,940 So if you want to recall this stopping, just watch the previous video and then execute all three methods 70 00:05:54,940 --> 00:05:57,010 for each instance of an object. 71 00:05:57,020 --> 00:06:06,220 OK, so these three methods right here execute them for every one of these object instances, Audi A3 72 00:06:06,220 --> 00:06:07,240 and Ford Focus. 73 00:06:07,780 --> 00:06:10,120 This is about it. 74 00:06:10,120 --> 00:06:13,750 Regarding the assignment summary, wish you good luck. 75 00:06:13,960 --> 00:06:18,550 Try to resolve it by yourselves and you can see the resolution in the following lecture. 76 00:06:18,760 --> 00:06:19,390 Thank you. 77 00:06:19,390 --> 00:06:19,960 Good luck.