Python 5.5 : Exercise : Handling invalid input

We will start to improve our program and here we will manage the case of error, if for example, I run my code and I enter anything at this level! you will see that there is an error, I am told about line 16 so at the level of the call of the function, so it is in the function that there is the error at the time of the conversion on line 6, so we can't convert strings into ... int that's what it's about and the exercise will consist in managing this error case and send back to the user error you have to enter a number retry, so to do this you have to modify the function ask for the number so we'll come back in a few minutes for the correction concerning the correction we're going to come here, we're going to do a try as we saw above colon I'm going to do tab at this point and then I'm going to do except colon put a print error you have to enter a number comma retry and we want it to restart the magic number until the user has entered a valid number, so for that I'm going to do a while loop, while the answer converted into int is equal to zero two points tabulation here and I will declare answer int answer int equal to zero like this I launch my program I enter anything it asks me again the number I continue and when I have three it asks me to try again or five I find the number, good it was all for this exercise we say to ourselves very soon for a next one ... video concerning the case of error of the number min and the number max.