This is a fun little project that I like to do in my spare time. It is a number-guessing game written in Python. The basic idea is to have the computer produce a random number between 1 and 100 and then have the user try to guess it.
In this code, we first welcome the user and generate a random integer between 1 and 100 as the secret number. Then we give the user 5 chances to guess the number using a while loop. Inside the loop, we take the user's guess and compare it with the secret number. We give feedback to the user if their guess is too low or too high. If they guess the number right, we congratulate them and exit the loop using the break
statement. If they exhaust all 5 guesses, we inform them that the game is over and reveal the secret number.