So let's not talk about exceptions.
Well, you know, sometimes our court is producing killers and this is not good.
We don't want to get unexpected errors in our court.
We want always when we run the court to be sure that no matter what happens, we know what the error
is or to expect what there is going to be.
So let's see the following example, let's write items equals int.
Inputs and then type a number of items.
They right to print items.
OK.
Now, let's run this court and see what is basically going to happen, so now we're asking for a number
of items.
But here I will do something different.
I will not put an integer.
I'll put some string is.
So if I run it now, you see that we are getting an error.
And this is because the compiler was expecting that we were going to get.
An integer, but what they actually sent to the function was a string, and for that reason we were
getting a value error.
And if you see this in red, this is not good.
This means that there was something less vigilant protecting your gold.
But how you can figure this in Bitel.
So I will shift this coat and I write try.
OK, so try means that we're trying to statement and then accept a volume error.
So this means that if a value error appears, we're prepared.
So we want to send a message to the user when a value error appears, maybe to give him some advice
what he can do.
So here are right to print.
Your value is not on.
Integer.
So now if I run the code once again.
And if I write the string here, then I'm not getting any Rowbottom advice that I need to put a value
that is an integer, so my value that I put is actually an integer, and this is why it is not deceptive.
But note here that this will not work for any type of federal.
It work only for the value.
OK.
And if we see similar type of error, for example, total 30.
So we showed this to me, the price per item, price per item.
If this is a, quote, total divided by the number of items.
So after you select print item and let's run this quote, so here, obviously if I select items to be
zero, you know, division on zero, it's impossible.
So if I do it, you see we're getting zero division error division by zero.
And here again, we're receiving an error.
And this is different.
That's why we see it in the red.
So in that case, we would like to create another exception so I can separate except and then you can
copy and paste error there just to be sure that it is the exact error that you need to encounter.
So now right print you can not divide by zero.
OK, so if I run this again.
And if I write a number of items to be equal to zero, you can see that now we're getting governments
who cannot abide by Israel and why we need different exceptions for different errors.
Well, this is simply because.
There was a different solution to a different terror invasion, if issue is.
It's not an integer four, is there a division error, then the user will not know what to do.
Right.
It is quite useful when you want sultry or cold very well, and basically create the courts that are
error-free.