Alright, guys, so today I decided to kill some time by messing around with a simple number guessing game. I remember playing these as a kid, and I figured, why not try to build one myself? It seemed like a fun little project to get my hands dirty with, nothing too crazy.
Getting Started
First, I needed a way to pick a random number. It is a guessing game after all. I found a simple way to do this, making sure the computer could select a number between 1 and 100, so there’s a good range to guess from.

The Game Loop
Next up, I needed to set up the core of the game – the loop where the player keeps guessing until they hit the jackpot. So, I created this while loop, you know, the kind that keeps running as long as a condition is true. In this case, it keeps going until the player’s guess matches the secret number.
Inside the loop, I first asked the player to input their guess. It is vital to change their input to an integer, because, you know, computers and their types.
Giving Feedback (Hot or Cold?)
After getting the guess, I needed to give the player some feedback. Just a basic “too high” or “too low” kind of thing. So, I threw in some if and else if statements. If their guess was lower than the secret number, it told them their guess was too low. If it was higher, it told them it was too high. Pretty straightforward stuff.
The Victory Moment
Finally, if the player’s guess was spot on, the loop breaks, and a congratulatory message pops up.
I set up to print out something like, “You got it! The number was [whatever the number was]”.
Wrapping Up
And that’s pretty much it! I ran the game a few times, you know, to make sure everything was working smoothly, and, no surprise, a simple number guessing game is not that hard to make. It was a neat little refresher, a good way to tinker without getting bogged down in anything too complicated.