Number Guessing Game banner

Number Guessing Game

3 devlogs
3h 27m 7s

The program starts by asking the player to pick a difficulty — Easy, Medium, or Hard — which sets the range of numbers the random number can be chosen from.
Once a difficulty is picked, it generates a random number and then enters a guessing loop…

The program starts by asking the player to pick a difficulty — Easy, Medium, or Hard — which sets the range of numbers the random number can be chosen from.
Once a difficulty is picked, it generates a random number and then enters a guessing loop. On each guess, it checks if the input is a valid number within the range, and tells the player to go higher or lower until they get it right.
When the player guesses correctly, they’re asked if they want to play again — if yes, a new number is generated; if no, the game exits.

This project uses AI

The first hour and a half I didn’t use any AI but then Claude gave me an idea on a new and shorter type of structure. It didn’t give the code, just the structure. I also used it for debugging the last part.

Demo Repository

Loading README...

evan.dcassidy

This last part took me too long :(
It basically asks if you want to play the game again.
I did learn a new command: exit()
And that’s it!!

Attachment
0
evan.dcassidy

So… Because the code was very difficult to understand and it was a maze, I changed the whole thing.
Now it is a much better format and much easier to understand.
I´ve learned about tuple unpacking.
Now the code generates a number before you enter your number and thanks to putting the variables of low and high right after asking for a difficulty, I don´t need to write the same code three times. I just need to use an f string and put the two variables in these: {}
I don´t think there is much more left to finish the code.

Attachment
0
evan.dcassidy

These is my first hour and a half on this project. I’m doing much better than my last one. I’m using less AI. Now I can code a bit more by myself.
So today I started by making you select a difficulty, then, depending on which one you chose, you guess from 1 to 10 (easy), 1 to 100 (medium) and 1 to 500 (hard). Now, it generates a random number and if you guessed correctly, it prints: “You guessed the number correctly”.
In this session I learned the .lower() / .upper() commands and how to generate a random number (random.randint(x,y) ).

Attachment
Attachment
Attachment
0