Hey curious people π, if you are looking for a way to write and run python code in your smartphone, you are just at the right place. let's see how we can do that!
Download Qpython3
First of all make sure you have downloaded the app Qpython3 in your smartphone. If you haven't yet click this link to download the app, or search for QPython 3L - Python for Android in play store. If you are using IOS, there are similar apps like Pythonista 3. Or you can also use a browser-based interpreter, but I will recommend that only for basic usage.
How to use?
let's get the basics done first! we'll first open the app, create a python file, write 3-4 lines of code, and run it. Let's see how to do that step by step.
Step 1 - Open the app and click on the editor
Now you'll see a screen like this(your theme/colours might be different):
Step 2 - Click on the second icon in the top right corner of your screen to add a file.
You'll see a screen like this once you do so:
Step 3 - Click on Script and name the file intro.py(Actually you can name the file whatever you want, just make sure to add the extension ".py" after the name of your choice) and press OK.
And now we have a file we can code in! Let's write some code and run it. Copy this code to your own file in the app.
#assigning 2 to variable x
x = 2
#assigning 3 to the variable y
y = 3
"""
adding x to y and storing the
result in variable z
"""
z = x + y
#printing variable z to console
print(z)
Now let's hit run and see what happens. The run button is the triangle in the middle in the lower options bar. There are other buttons too for saving the code, undo e.t.c.
After clicking run if you see this screen below which says 5(ignore all the other stuff), then we are good because 3 + 2 is indeed 5! Our code worked! And now we can write whatever code we want here, as we learn more.
Top comments (0)