Python 5.2 : Exercise : ask number
We will continue our learning and here the objective is to do an exercise to better understand what we have ... seen above, for this purpose we will make a function ask the number def ask number like this which takes as parameters the min and max number, like this two points and inside, you will have to ask the user to enter the magic number what is the magic number included and you give the interval between one and ten except that at this level you don't have to enter the int but you have to use the max number and the min number that we have entered as parameters and at the end of the function you have to return an int so a number well we'll come back in a few minutes for the correction concerning the correction here, we're going to make an input that asks the user for the magic number here we copy this and we put inside at this level we're going to put a percentage S and here, a percentage S as we have seen above for the concatenation of the chains and then we will put powerful, parenthesis numbers min comma max number like this without forgetting the question mark at this level and here we will put answer str to mean that it's a string response and we're going to return an int response so I'm going to start by converting the response by making int response equal to int in parentheses str response here and I'm going to return my int answer like this and here, I'm going to call my function ask for number and inside I'm going to put min number comma max number I launch my program it asks us well the number we're going to put four we enter, nothing happens because we put nothing well the objective here, to convert the str answer into int is to be able to manage more easily the conditions when we're going to put the constraints so on and so forth and we say to each other very soon for a next video concerning ... the exercises on the conditions.