Hi.
In this video, I'll show you the solution to the project.
So that's my final code.
It's one file main.
That's p y.
And I've got two classes here, so that's a complete code.
The classes are article and received.
The article class gets an article ID as input from the user, and so we create an instance variable
using that article ID.
This could also be article ID.
Either way it's fine.
Self ID is also fine.
ID is a keyword, but when it is attached to something else like self, then there's no issue with it
being a reserved keyword in python.
Then we extract the name and the price from the data frame, which will load it in here.
Note that the data frame has been loaded with ID as a string data.
So when we compare the ID here, we are comparing the ID against the user ID, which will be received
also as a string.
So string against a string.
Then in the available methods, I am extracting the number so that number writes zero or 87, wherever
it is.
So that number will be stored here.
So this would be either zero.
In our example, given this data or 87 and I return that number directly.
Now here you could also have this as if in stock is greater than zero.
Return true, else return false.
However, this is not necessary and it's a good idea to actually return the number itself.
Because you may also need it later.
You may need the actual number.
So what will happen here is that if this returns zero.
And down here we check if Article two available, so we check the value returned by this.
This will be evaluated to false if the available method returns zero.
So basically.
This is like af0 print.
Hello and hello will not be printed out because zero is like false.
But if zero was another number like 87, then hello will be printed out.
Right?
That's what we're doing here.
So.
I prefer this way.
Then we have the received class which gets the article as input.
So article is the instance here.
So we get the article ID from the user.
We instantiate the article class by creating an article instance.
We check if the article if is available through the available method we just covered, and then we create
an instance of a received providing the article as an input and then we generate that received.
So generate this this method here which contains all the code of the PDF Creation Library pdf.
So here I'm giving the number of the article self Article ID so ID is a property of the article instance.
So that's a property, an instance variable.
In other words, property attributes.
Whatever you call it.
And then we have article.
That name.
Articulate price.
All of these will be printed out in the received here, and that's the final code.
So that's my solution.
I know yours is a bit different.
That's fine, but I hope you got the expected output.
So thanks a lot for following and I'll talk to you in the next days.
Tomorrow.
See you.