- +91 7075575787
- [email protected]
- Moosarambagh, Hyderabad
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.
Libraries:
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.
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 none.in 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
Note: Make sure you have added path while installing the software’s.
https://techieyantechnologies.com/2022/07/how-to-install-anaconda/
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”.
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.
How can we help you?
🟢 we are online | privacy policy
WhatsApp us