 So we're going to now take sort of the sequential variables, the conditional statements, the functions, and the loops to build one of the most hallmark examples in computer programming, high, low. Now the entire rule to high, low is the computer is going to generate a random number from 0 to 100 or some number. It really doesn't matter. Then the computer asks us to guess the number. Okay, well we type in some number and then the computer is going to make an evaluation. If that guess is too high or too low, it will tell us and we have to repeat the entire process until we get the correct number. So to start taking a look at this, we're going to first need to get a random number generator. So import random. Now random, this is more of a design choice and let me maximize this. There we are. Random, this is a lot of words to type. And so I know it's only six letters, but I'm a particularly lazy developer. I like to shorthand things. And so I can actually come in to an import statement, something like import random, and then add as R. And what as is doing is basically saying random now has the alias R. And that just means that now instead of me having to type out random to use random functions, I can type R. And that's just it's a very shorthand thing, but it makes my life so much easier. So the next thing I'm going to do is I'm going to generate my random number. So random num is going to be R. Again, this is that example of I can just generate the random number dot. And now we're dealing with the functions that the random library has to offer. So I'm going to use one that will generate random integers. I could have done a different approach. So I'll show that in just a second. But random allows me to say I want to set a low number. So we'll say one to a high number. And so now we have a random number from one to 100. Like I was saying, there is another way I could have done this. I could have used random random is going to generate. So just to start random integer from one to 100 random float from 0.0 to 1.0. Okay, well that doesn't really help us in the idea of generating a number from one to zero, but I could have dressed this up and I could have used the fact that random is again still giving me some random number, but treat it like it's a percentage. So now that random dot random, it's going to generate 0 to 1. So it may generate like 0.58. 0.58 times 100 is 58. Now we also still have to deal with the fact that this would be, in our case, a floating point number. I don't want my users, whoever is playing this game, to guess decimal places, but we could convert it into an integer with int. And that will drop off all the decimal places. So this is now going to generate 0 to 99. That's not quite what I want, as you can imagine. Again, I wanted 1 to 100. So the last little bit here, plus 1. That'll say that even if we randomly generate that 0, if we add 1, we start at a baseline of 0. And even if we generate a 1, well, we never generate to a 1.0 with random, we always get to 99.9999. Even if we get to 99, we add 1. And so both of these work. Neither one is better or worse. They will do the same thing. Regardless, we now have our random number. So now we need to get the user's input and check and effectively play high, low. So in this case, we'll say, I'll call it guess, and we'll get an input from the user. Enter a number. Now, with this, again, let's say 50. I'll start off at the very basic. As of right now, I have no idea whether or not I was better, worse, or the same. Right? I have no possible solution. So now we get into our if statements and our conditionals. Well, so while my guess, and I do need to convert my guess into an integer, because this is a string, while guess does not equal my random number. Because again, the entire idea here is, well, I said 50. Let's imagine that the random number is 75. Right? Okay, well, I need to keep guessing. So, and just because we can mentally play this, let's actually, this is one of the fun things about Jupiter, let's actually see. Okay, so the random number is 27. And I just typed 50. Okay, well, all right, I need to now tell the user that they were incorrect, and they need to repeat the process. So in this case, we're not just saying incorrect, we need to tell them what they did, were they too low, or were they too high? Okay, so first just incorrect, then we'll use a conditional statement. Once again, we saw they are not correct. So are they lower or higher? Well, if int guess is greater than the random number, print too high. Because again, we went too high. I typed 50, but the number was 27, so you were too high. Else, else in this case as well, it wasn't too high. So we need to tell them to low. Now, if we just run this and I will for our sake, this is going to happen. And just as you can see with this star, this means that Python is still running. It's running an infinite loop, because we never modified our guess. So let me stop that. So just to get rid of this cell, that way we don't see that stuff again. So the last thing we need to do outside of our conditional outside of our if statements is we need to update our guess. This is always a super important part when we're dealing with any type of loop. The loop conditional has to change, otherwise we're stuck in this infinite loop forever approach. So now, okay, well, it was too high. Enter a number. Okay, well, I'm going to just type I'm just for our sake, I'm going to say 25. I know it's 27. But just to show off what is going to happen, I type in my 25. Too low. I entered 25. It's too low. Okay, well, I'm playing this game of now high low, I could say in this case. I don't know. Well, I did 50. I did 25. I need somewhere in the middle there. So 37. It's too high. Okay, well, 25 is too low. So I'm just going to go ahead and get the answer. Okay, well, it's pretty anticlimactic if you think about it because it did it. And then nothing happens. Well, we could doll this up a few different ways. For example, we could celebrate. Congratulations, you got it. Well, we have to modify the guess again. So let's say, for example, we now have a new number. We'll go ahead and start again at that 50. And it was too high. Well, now if we were to type in that 12. Congratulations, you got it. We can continue with this. And in fact, now what I'm going to do is turn it into a nested while loop. The next effect is basically do you want to play again? Let them continue getting new games the entire time. So how would I modify this? In that case, these two initial cells, I'm actually going to move them and join them into our, our, our Hilo game. So and because we no longer need this print statement, again, it's a game, not just, you know, seeing what we can do. And let me get rid of those cells. There we are. Okay, so this again hasn't done anything to our game. But now I'm going to take all of that. I'm, I'm cutting it out to paste it later. The entire idea is I know all that code still works at functions is perfectly fine. But I'm going to build out the outer structure of the do you want to play again? So I'm going to make a variable called play again. And I'm just going to start it with a Y. Again, this is more of a default to assume that they want to play again. So now while play again is why play high low. Now when I pasted everything back in, I do have to tab it, you know, boom. But there we go. I now can play high low as many times as I want. So not pay high low. And this is not a pay to play style game. This is freeware. So there we are. Enter a number. Okay, well 50. Oh, two lows. Okay, 75. Too high. Okay, 65. Too high. 60. Too low. 62. Congratulations, you got it. Enter a number. Okay, well we didn't do one thing. Again, this is technically an infinite loop because play again never changes. But we can modify that. We can come in. After we tell them congratulations, you got it. Play again. Do you want to play again? Y slash in. And again, you could compound conditionals of all the different types of Ys or yeses and nos and whatnot. But again, now we I did it again, then I see that play again. So now once again, I can run the game and I can play high low as many times as I want without any issue. So again, let me start from the top. What's going on here? Stop you restart. Let's try this again. I'm not sure why it did that. So let's just see. Okay, I think it may have just gotten hung up on some part of it may have the while loop was still running, I think forever. Okay, so enter a number. 50. Too low. 75. Too low. 80. Too high. 75. 78. Incorrect. It's still too high. 77. Congratulations, you got it. Do you want to play again? I can now input yes and our conditional will start a new game. So now 50 is too low again. 75 still too low. I really hope my random number is different this time. In fact, I'm going to guess it. Okay, okay, that was just me checking that out 859095. Too high. Wow. Oh, too high 92. Congratulations, you got it. And so now I'll just go ahead and type the in and since in is not a capital Y. Congratulations, you've just played and beat high low.