How to Learn Python programming using Termux - 2021

Termux is a great tool that allows you to do hacking on you android phone one of the best thing about the termux app is that it allows you to install and run python on your android phone.

How to Learn Python programming using Termux - 2020

Python:

Python is a high-level interpreted language created by Guido van Rossum. If you are thinking about learning a programming language in 2020, python is the best language I can suggest. you can create tools that will allow you to simplify your work. python is easy to learn and if you are thinking about learning it using termux then this post is for you.

Using termux you can learn intermediate level python programming you can research on external modules of python that will allow you to create some really useful projects. If you are really serious about python then I will suggest you learn from multiple sources and learn topic-wise. You can also Install GUI IDE in Python That will help You to make your learning Process faster. 



The benefit of learning python using Termux:

Termux is portable. When you start learning to program you get new ideas while you are not at your desk if you are working on some project then you certainly realize how you can solve that bug you were stuck from the past few days. Using termux you can code anywhere and even without internet so as long is python package is in your termux app you can code in Python language no matter where you are. 🔥

You can download a certain project from the internet and then paste it into your termux app and then you can execute it. You can attach a physical keyboard with your phone and then it will be more easy to do programming on your phone.


How to install Python in your Termux app:

Install Python2:

If you are going to learn python don't have to install python2 you on your termux app I am just showing you how to install python2 you because a lot of project on GitHub still works on Python2 and if it's giving you error with python3 while execution you can run it with Python 2 and it will work most of the time.
pkg install python2 
How to Learn Python programming using Termux - 2020

This command will install 5MB or archive in termux app.


Run Python2:

To run Python2 In Termux you just have to type:
python2 
How to Learn Python programming using Termux - 2020



Install Python3:


To install python3 on your termux app you just have to install Python package from termux repositories.
pkg install python
How to Learn Python programming using Termux - 2020

It will install approximately 9 MB achieve and it will take up to 49 MB of space in your phone.


Run Python3:

To run Python3 in the Termux app you just have to type:
python
How to Learn Python programming using Termux - 2020

or you can also type python3.




Modules in python:

Modules are files that contain codes. There are a lots of Modules in python and every module enable you to do something different than others. pygames is a module that allows you to create games using python, Tkinter is a tool that is used for making GUI for python programs. Selenium is a Module that is use to Automate browsers. Requests is a module that use to send HTTP requests.


How to install Modules in Python using Termux:

To install a module in python you just have to type the below command and the green part of the code will change with the name of the module you want to install.
pip install requests
How to Learn Python programming using Termux - 2020

This is the most common way to install the modules if this is not working then you can visit this site to learn about the package installation.





Tools to Write Python programs in termux:

To write a Python program you have to open a text editor in termux you can use Nano which is a good text editor to write a Python program. When you will give you a clean interface where the color of the codes will be changed which will make code writing easy


Install nano text Editor:

Type below command to install nano text editor in Termux. Which will help us to create 
pkg install nano
How to Learn Python programming using Termux - 2020


Enable Extra Keys In termux:

If you are going to write code on termux you have to move your cursor a lot for editing purposes. In termux app you can enable Extra keys that will allow you to navigate quickly. I have written a complete post on [ How you can enable Extra Keys in termux using Single command ].it will only take 30 sec to enable those keys.



Write Your First Python programs in termux:


Step1:

In Python, you have to create a .py file that will contain your python code.type below command to create a py file.
nano Hello.py
How to Learn Python programming using Termux - 2020

Nano : is tool name.which will open a text editor.
Hello : is a file name , you can change it with any name you want.
.py : is python file extension like .txt is Extention of text file or .mp3 is for sound.



Step2:

1. Now type any Python code You want, if you don't know anything about python you can type and this code will print Hello world on your screen.
print("hello world")

2.Press CTRL+X.
3.Press Y and then press Enter.

How to Learn Python programming using Termux - 2020



Step3:

Type Python space file name .py to run the python file you just have created.
python Hello.py
How to Learn Python programming using Termux - 2020

This hello.py Programm will print "Hello World" on your termux screen.



Start Writing your own Python programs in termux:

Now you know that How you can create a python file in termux and you also know how you can run that file the only and biggest thing that you have to do is learn Python programming. There are hundreds of websites and YouTube channels where you can learn python. 

I can give you a list of websites where you can easily learn python programming from beginner to advanced. 

Here are some basic Python codes that you can copy-paste and get familiar with python in termux.

Sum of 2 Numbers in python:



save this code in nano as anyname.py and run it and using this code you can find sum of any number.



Generate Random Gmail :

Generate a random Gmail using the below code, This Gmail will not be valid to log in but you can use this Gmail to log in at any site where Confirming Gmail is not required.



save this file as anyname.py and run it and using this code you can Generate a random Gmail address.



Generate a Random password:

Below will generate a random password that will be strong and not easily hackable by brute force attack or dictionary attack




Create Your Own Falling Effect in termux:

Using the Below code you will be able to Create a matrix effect in termux and only using python. By You can also use This post if like matrix [ Use matrix Package Like a Pro ]



save this code in nano as anyname.py and run it and You will see a matrix effect on your terminal.Please Adjust Your screen to make it fit perfectly,it will look cooler if you have installed a green theme in termux. If you want to install a Green theme on your termux app then you can read this post. [ Install Hackers theme in termux ]

Conclusion:

Python is the coolest programming language for me (at least today). The best thing about python is, it is easy and a lot of projects are available on the internet. half of the hacking tools for termux are written in python. I know Learning Python on your phone is a little difficult but I have also learned to program using my phone so it is not that difficult. there are also IDEs for python on play store but I love to code on termux because this is the only app where my all-important tools are available so I am not gonna switch to something else just for python. You can create really awesome projects in python by learning some modules like requests and beautiful soup. i have just added 4 codes but i will add more whenever I create something new so keep checking this post one in a while. Also, Learn [ How you can Encrypt and Decrypt Files in Termux ]. Thanks For Reading Guys, and as always Stay Ethical. 👾



Post a Comment

8 Comments

  1. How to install python module for tremux

    ReplyDelete
  2. I saw a tool for generating leads with termux on a Facebook post with tool screenshot but I've forgotten the name can u help me with the tool code it's something like covard tool or so

    ReplyDelete
    Replies
    1. python tool for generating leads? You can find 100s of them online but with type of leads you wanna generate?

      Delete
    2. An affiliate lead for my website.
      To gain visitors to my site

      Delete
    3. 95% tools will use you phone to visit your own site 1000 times a day, I will be considered as spam, I never used those tools because thy are not good for google algorithm.
      If you want you can search "Python Lead Generator" to find those tool.

      Delete
  3. What about java ide for termux

    ReplyDelete
  4. I really want to learn programming I can be your apprentice If you want♥️

    ReplyDelete

If you Wanna Learn about Termux and connect with more people like you then you can join our Discord Server Termux Discord Server