Python 2.9 : Errors and exception handling
We will continue with our program and we will want for example if the user enters the numbers it will display a message like print error colon you have to enter numbers for the age we want to display this on the screen when the user enters the characters instead of the number or the digit well we'll comment we see that this line doesn't work when the user enters the characters so we'll ask the user to try to execute this and for the fact we need this command and we put tab at this level we see very well that has an error and here there is not really any it's just that we didn't continue to write the code to make we have to put except, except colon and we write this we are going to execute neuro code now tata age you see there is always an error because this line has not been executed the next age has farted execute not if we have a character trait but that does not hold the line 6 has been executed it is that here error you must enter numbers for the age if I rerun my program I put tata and here I put everything works normally so to manage the case where we have between the letters and that the user it returns a message to the user we must make an else at this level else point and here make a tab I rerun my program I wait for you you see this line does not work anymore because we managed the exception well when we look at our code at the level of we see that it is underlined it is not really it is not an error we can just write value error to say that this line manages that the exceptions. Everything works normally afterwards we will put the conditions so that the user must enter a number if he enters another character than the number we ask the number each time.