TechieYan Technologies

Number Guessing Project In Python


You may discover ways to write an easy bet-the-wide variety sport in Python using an anaconda ..The person has to guess the randomly generated number that lies among the variety from 1 to 10. That’s it.


Random: Random module is an in-built module of Python that is used to generate random numbers. These are pseudo-random numbers because these are not absolutely random. This module can be used to perform random movements which includes generating random numbers, print random values for a listing or string, and so on.

Number Guessing Project In Python

Code Description & Execution

Program Methodology

Creating the basic working game is mandatory. After that, we can add more features as discussed. So, we are going to create the basic version of the game in this section. And then we will move to add new features.

I want you to try creating the game without blindly copying the code. 

Firstly, we need to import random library .a variable num is declared in which random.randint(1,10) and guess is declared as this while loop is used when guessed number is taken as input .if guessed number is equal to num  won is printed if not try again is printed

How to Execute?

Note: Make sure you have added path while installing the software’s.

  1. Install the prerequisites/software’s required to execute the code from reading the above blog which is provided in the link above.
  2. Press windows key and type in anaconda prompt a terminal opens up.
  3. Go to the directory where your requirement.txt file is present, not just requirement.txt, if you want to execute any .py or .ipynb files, you need to go to that specific folder or path, where they are saved.
  4. <<directory of your file:>>. E.g., If my file is in d drive, then.
  5. Type d:
Number Guessing Project command
  1. cd d:\License-Plate-Recognition-main    #CHANGE PATH AS PER YOUR PROJECT, THIS IS JUST AN EXAMPLE
Number Guessing Project In Python code

          7. If your project is in c drive, you can ignore step 4 and go with step 5

          8. Run pip install -r requirements.txt or conda install requirements.txt (Requirements.txt is a text file consisting of all the necessary libraries required for executing this python file. If it gives any error while installing libraries, you might need to install them individually.), example: pip install “module_name”.


Number Guessing Project In Python result

Issues Faced

  1. We might face an issue while installing specific libraries, in this case, you might need to install the libraires manually. Example: pip install “module_name/library” i.e., pip install pandas
  2. Make sure you have the latest or specific version of python, since sometimes it might cause version mismatch.

Click Here To Download This Code And Associated File.


We have created a simple number guessing game. Now, it’s your turn to think of games that you were playing when you were young. Make them using programming language and share with your friends. We can digitalize most of our childhood games.

+91 7075575787