Hi, everyone, again, so we have seen several examples regarding OLP, imagine yourselves talking
and saying, I Demitry, you want to stop these examples going because we went over several times,
actually the model of how to create instance of an object, methods of object using in it and using
the self barometer.
And now it's time to practice.
OK, this would conclude the first part off object oriented programming in Python.
Then we're going to see inheritance and so are much more cool stuff regarding object oriented programming.
So let's begin going over the homework assignment.
Right.
So and this assignment, you need to create an object class classes, methods and instances, the whole
shebang.
You will need to use all the tools that you have acquired in the last lectures of this topic.
So these are the instructions of the assignment.
First of all, please create a car class and it's appropriate init method.
Don't forget that any method has two times underscores in each side, not once and only then you will
see the background color of init method colored as a special method.
So we have to underscore in each side and it should receive one list type arguments.
All right.
So eight methods can receive arguments.
And in this init, I wanted to receive one list type argument and this is for that part.
All right, then this great object of an instance.
All right.
So we create two instances, one for Audi A3 and one for Ford Focus.
Then the properties of this instance erm would receive a list which will contain the following variables.
OK, so property section, this part.
OK, this means actually I'm talking here about the content of the method and it each will receive in
one list argument as we just talked about, and basically that list argument would contain the following
information.
OK, so there will be two lists, OK, with these variables inside the lists and here I'm explaining
what each item in the cell would contain.
OK, so the first one is year of release, then current car price the name, then doors closed status.
OK, so we have one for full focus list.
Two thousand five, five thousand for focus and two for the status.
And we have one for Audi A3 as well.
So this is for that part.
So basically you need to create two instances and above each instance, create a list and appropriate
list.
And that's this list should go inside the instance.
OK, this is about this part then could create two, actually three method classes.
The first method should calculate insurance insurance price by using the conditions if the year OK,
if the year off release of the car is between 2010 and 2020.
OK, obviously you need to use this these variables right here.
Once you pass the list into the as a property into the init method, you should use this method and
use these values to calculate it.
So this is the condition of the year of the use is between 2010 and 2020 and the current price is between
six, six grand and seventeen grand.
The insurance will be five percent of the car wharfe, which is this is the car worth.
OK, so you need to calculate this, this insurance price by using the conditions I've stated stated
here inside.
Right.
Then for every other parameter the car would be seven percent of the car's worth the not the car price.
The insurance price actually.
We just fix it.
OK, so this is you have like two, two ifs here and you need to calculate the insurance price by using
these two items here.
All right, following you have another class method door.
Satis is its name.
It will print what whether the doors are closed or not.
The last value of the list indicates it.
It's a it's true means the doors are closed and a false means, meaning they are open.
OK, just print it and you have a third class method.
Please print because these are in the following structure, the car model as Hellblazer variable it
would release.
It was released in the year of OK place here.
The second and its cost base, the third variable here.
Please use a string formatting approach for the print.
OK, we have covered the string formatting in the previous lecture and the live coding example lecture.
I have talked about string formatting.
So if you want to recall this stopping, just watch the previous video and then execute all three methods
for each instance of an object.
OK, so these three methods right here execute them for every one of these object instances, Audi A3
and Ford Focus.
This is about it.
Regarding the assignment summary, wish you good luck.
Try to resolve it by yourselves and you can see the resolution in the following lecture.
Thank you.
Good luck.