Python 5.8: Limit the number of lives: for loop

We're going to continue our learning and here we're going to do the same thing but with the for loop, so I ... will just restart my code, and if at this point I throw anything, you'll see that the number of lives doesn't decrease it decreases if I throw a valid number if I put not example 45 and I throw it doesn't decrease because it's not a number, number included in the interval that we defined above, that is to say the min and the max so if I throw by ... example that it's at this level that the number of lives decreases and this is a very good behavior for our code, ... I'm going to stop this and here I'm going to comment from here all this code I'm going to copy and paste here here we may need to declare this I'm going to delete this and here we're going to delete desincrement of lives from here as well I'm going to comment this and here we will do a for i in range zero i will put number of lives at this level and lives will equal number of lives minus i here when the user is going to win to get out of the loop, we're going to have to make a break and I'm going to restart ... my code and I will make the effort to win, four the number is bigger 6 the number is smaller, 5 you see that it shows you lost, the magic number was 5 so to remedy that I'm going to make a boolean that is to say I'm going to set winning equal to the false And inside if the user wins, we'll have to set winning here to true Winning will take the value true and it will come out and then we'll do an if, if win equals false we display this tab I'm going to rerun my code well I'll try to find it, the magic number is bigger 9, bigger 10 Bravo, You have won, you see that it no longer displays this code, And if I make the effort to lose you I raise, I'll put 2 each time you see that we lost so now we have both versions, we have the one with the for loop and we have the one with the while loop Everything works normally, so that's all for this video, we say to each other very soon for a next section ... about maths.