Introduction: Make a Really Cool Matrix in Python!
Hi guys! This instructable will teach you how to make a matrix in Python! Usually, people would make a matrix in Batch because it's easy. But this time, I'm gonna show you how to make a Matrix in one of the powerful computer languages.
You will just need the python environment for this.
Step 1: Import the Random Module
Import the random module. You can refer to the picture here. Or just type down Import Random.
Step 2: Make a Forever Loop
For the matrix to continuously rain down, we also need to make a forever loop by just typing while True: (make sure the True has a capital T;Python is a case sensitive language.)
Step 3: Assign a Random Number for the Matrix to Rain Down
We will need to assign a variable will have a random number for the matrix to display. To make a real matrix effect, we will have to display continuous random numbers for the effect, right? It would be boring if we saw the same number in the matrix. So we will assign the random number in the forever loop, which will continuously get a random number every time!
Type in the file:
MatrixNumber = random.randint(0, 1000000000)
#Just get a high range for a good matrix!
Step 4: Display the Random Numbers
Display the matrix by typing out this code:
print(MatrixNumber, MatrixNumber, MatrixNumber, MatrixNumber ,MatrixNumber ,MatrixNumber , MatrixNumber, MatrixNumber)
Make sure this statement is in the forever loop.
Step 5: Check It Out!
Now you have finished the code!
Now check it out by running it and watch the numbers go doooooowwwwwwnnnnnnn!!!!! :-)
Step 6: Download the Source Code
For more reference, download the python source code of the matrix.
1 Person Made This Project!
- roboticsMazidMaumder made it!