Skip to main content

Posts

Showing posts with the label blogofchamodh

How to Code a Number Guess Game With Python.

How to Code an Advanced Number Guess Game with Python. banner of the game by me:) Hello everyone, I am sure you have played the Number Wordle (Number Guess) Game. Have you ever wanted to create your own number guess game? If yes, this is the time.  It is a game like a wordle to friends who don't know what a number guess game is. The Computer generates a random number; all you have to do is guess that number. If your guess is correct you are rewarded with some points and granted access to higher levels. With Python, you can code this very easily, and let's get started. At this level, we will create a CLI game so that you can understand the basics, and let's move to GUI when you are ready. Prerequisites. All you need is Python and if you have not installed Python yet, visit  https://www.python.org/downloads/ and download the appropriate Python version for you. Getting Started. Create an ASCII banner. First, we want a banner to show the user when they enter the game. It will ...

Flip a coin million times w/ Python

Photo by ZSun Fu on Unsplash Welcome everyone to my blog. I could not write a new blog post for the last year because of my heavy work schedule. So I thought to write an article on a recent project done by me. Let's get started. Imagine that you want to flip a coin. Perhaps you don't need a complex python script to flip and find a result but what if you're going to flip a coin 2 million times and check the results. Then you have to invite Python to do all the hard work for you. If you are not interested to dive deep, just go ahead and check my project on Github. And also don't forget to follow my profile for the latest fun projects. and if you are a Python expert please feel free to fork.  🍴🍴 Link: https://github.com/chamodhk/coin-flipper Import the libraries you want! If you aren't using a GUI all you have to import is the random module. If you are an expert you don't have to import it too because you can write a function to get the random part done. im...

How to install PIP on Windows easily.

How to install PIP on your Windows PC easily. It is really easy to install pip on your Windows computer. If you have an Ubuntu, then follow this video  :    Now follow these easy steps.... DOWNLOAD GET-PIP.PY Go to  https://bootstrap.pypa.io/get-pip.py  . Right click and select   Save as Then the script will be downloaded. RUN THE GET-PIP.PY  All you have to do is to run the script you downloaded. To do that you have to install Python on your computer and if you have not installed python on your computer please install Python First. To Install Python on your computer, please go to  https://www.python.org/downloads / and download the appropriate setup file and run it on your computer. The open command prompt and navigate to directory which contains the cript you downloaded and run the following command.                  python get-pip.py That's all and make sure you have a better internet c...

Version 1.1 of RESULTANT FINDER is released!

A few weeks before I released my first version of Resultant finder which helps you to calculate the resultant of two vectors using a formula. When I wanted to find the resultant of a big number of vectors I built software with a different logic to find the size and its direction. In this version: the software divides the vector into two components along the y-axis and x-axis and lists them into two lists. after the user finished entering inputs; Python calculates the sum of all x components and y components and  calculate the results of all vectors given with the support of the Pythagoras Theorem and Triangle of vectors. As the vector triangle is right angled we can simply calculate the tan ratio of the angle, between the resultant and x-axis t hat is all here is the code: https://github.com/ChamodhNethsara/resultant/blob/main/resultant.py Hope You Like it :-) Happy coding Kavindu Chamodh Nethsara   

Find the Resultant vector of two Vectors With PYTHON!!

NEW ARTICLE:  How to Find the resultant of multiple vectors with Python! Using Python We can do many complex calculations. I learned how to calculate Resultant Vector using a formula with its size and direction in my Physics class. Then, I simply developed a CLI software to calculate the resultant of given two vectors Hope you like it :>) Follow me... Step :1 You need to install python on your computer. No matter what the operating system is you can find the ideal version of python from the official website of Python org And you will need a code editor like VS code and can download it with a simple Google search. (Hope you hate the first step Haha ) Step 2: we use the math module to calculate our resultant vector. The method I used as follows math.radians() : converts degrees to radians math.degrees() : converts radians to degrees math.sqrt()  : find the square root of a number math.atan() :find the tan inverse Step 3: the formula I used to calculate the size of the resulta...