Hey Python Learners, are you ready for learning python but have no PC then don’t worry, you came at right place. Here is a best solution for you if you can’t afford a PC. So welcome to the new post Run Python On Android. As we know python is growing very fastly and many applications are creating with python. The python applications can’t only run on the operating systems like Mac, Windows, Linux etc but they can also run on android OS like android phones or tablets. Many android applications are available to run the python scripts on android devices.
In modern computing you can’t do computing only on an 80×25 console window but you can also do that on phones, tablets, and desktop machines with rich user interfaces. Many android apps like QPython3, Kivy, BeeWare, pyqtdeploy etc are available to run python scripts. So if have you have not any computer then don’t worry these apps are very worthy for you. You can implement all your programming logics on these devices as you do them on PCs.
As there are many apps that run python codes but if you are planning to run your python scripts then QPython3 will be a best option for you. And in this tutorial i will explain QPython3 rather than others. So first of all we will see about QPython3 and then how to run python codes on this. So stay tuned till end of this tutorial.
QPython3 – A Brief Introduction
Overview
- It is a most popular IDE to run python on android devices.
- QPython is a script engine which runs Python programs on android devices.
- You can run python3 applications on QPython3.
- It contains a compiler, interpreter and a console.
- Apart from basic python libraries it also have Bottle library that is helpful for developing web applications.
- This app was released on 29 August 2016 and last updated on 25 February 2018.
- It is offered by QPythonLab.
- Currently it has been downloaded 500,000+ times.
Features
- Run Python3 applications including script and projects on Android device.
- Execute Python3 Code & File From QRCode.
- Support SL4A Programming, can access android’s feature, like network, bluetooth, location.
- Support Python3 console
- Support QEdit which allow you edit Python code.
- Support FTP server, which can let you transfer the Python3 project from your PC to mobile easily.
Supported Program Types
Currently, QPython3 can run the following types of applications –
- Console applications
- WebApp applications
- Backend applications
- Graphic Interface-based applications, and so on.
Recommended : 6 Best Python IDEs for Windows to Make You More Productive
Run Python On Android Tutorial – Getting Started With QPython3 App
So now we will learn how to run python programs on QPython3 android app. So we will go through step-by-step.
Download QPython3 From Play Store
First of all you have to download this app from play store. This is link for downloading QPython3.
When you will go to playstore then this screen will be appear. And now press the install button and download the app.
Open The App
After installing, we will open the app and the interface of this app will be as follows –
Now on the interface you are seeing some options like console, editor, programs, QPYPI, Course and community. You might be thinking that what they are, so now i am explaining them one-by-one.
Console
- So the console is a place in python where your code is run.
- It simply means a place where your code run immediately when you click enter.
- The interface of console look like as below image.
You can type your program here and run immediately. I will show you an example how this works later.
Editor
- Editor is a place where you write code or lines of codes or instructions.
- So the interface of editor is like this –
Programs
- Programs is the place where built-in programs are stored.
- Programs have two part one is Scripts and another is Projects.
Scripts
Here exists some sample programs for eg. like that-
If you open any one program for eg. bluetooth_chat.py then this will be as follows –
Let’s open and run the program hello_world.py and see what happens.
Hey, it’s running successfully.
Projects
- Some sample projects are stored here like below.
Recommended : Best Python Book For Beginners – Choose A Best Python Book
QPYPI
- It contains libraries.
- You can install libraries either from the way Install with QPypi or Install with official pypi.
Install With QPypi
On opening this below screen will appear.
You can install these libraries as your requirements.
Install With Official Pypi
On opening this below screen will appear.
Here you can pip install your modules.
Course And Community
- Course is a place where you will find all the python related courses.
- You can connect with people in community and can also ask many questions like usage and programming of QPython3.
Till now we have seen information and interface of QPython3 and now we will learn how to run python programs on android.
Recommended : What Can You Do With Python : Some Cool Things You Can Do With Python
Run Python On Android – How To Do That ?
Here i am discussing both way of running python program on QPython3.
- On Console
- On Editor
On Console
- Open the console on QPython3 app.
- Here i am just taking an example that is addition of two numbers.
- On console you have not required to save file or other things, you have to just write only codes and as you click enter, it immediately process the output.
- So now we will see what’s the result.
Yeah, It’s working fine and is same as the console on PCs. This way it’s not so hard programming on android device.
On Editor
Now we will learn running python program through editor on QPython3 app.
- So first open the editor, the editor look like as below.
- Then click on the symbol given below.
- On clicking this, a new screen will appear.
- Now you have to choose an option, here i am choosing Blank file. On clicking Blank File, a dialog box will appear that will ask you for save and don’t save of this blank file. You have to do what you want, either save or don’t save.
- On clicking save button now you have to select the folder where you want to save your file. Here, i am saving my file in projects3 folder as file name addition.py .
- finally we have save our file, now it’s time to write the code on editor. So here i have write program for addition of two numbers.
- Let’s see what happens on running this program.
Finally we have run python programs on android devices successfully.
Recommended : Best Python Frameworks To Learn In 2018
Now we will see one more thing. Give a look on below image, this is the toolbar of Qpython3 editor. And we have to understand what is the meaning of these symbols.
I am starting to explain them from left side.
- The first two buttons (< >) are for controlling indentation level.
- The next button is for Go To Line,when you click this button a popup will appear and in this popup you have to write line number on which you want to go.
- Then the next button is for saving the file.
- And the next button is for search.
- Then the next button is for Run.
- The next button is for Undo.
- And the next is for Save As.
- Next is for Recent.
- Next is for Snippets.
- And the last one is for Settings.
Also Read : Sublime Run Python – Running Python Programs On Sublime Text 3
So guys, this was all about the Run Python On Android tutorial. I hope this tutorial will be helpful for you. And if you have any query regarding this then leave your comment. And please share this as much as possible. In the upcoming post i will come with a post Best Android Apps for Python, till then stay tuned with Simplified Python. Thanks everyone
I love it a lot.