Pad Code AI
Run your first Python project on iPad with Pad Code AI
Create a local Python project in Pad Code AI, run it on iPad or iPhone, fix a syntax error and open the text file the program writes.
Pad Code AI runs Python in Ubuntu Linux on your iPad or iPhone. Start with a short program using Python’s standard library. The first time you run a Python file, the app offers to download Linux and Python (about 310 MB); after that the example runs offline and writes a file into your project.

Create a local project
- On the home screen, choose New Project and give it a name, such as
Reading Log. - Choose an empty project and save it to a folder you can access in Files. For a project that should be available offline, choose a location on your device.
- Use New File in the project and name it
main.py. If you selected a Python starter and already havemain.py, open that file.
Run a Python file
Enter this example in main.py and save it.
from pathlib import Path
minutes = [18, 25, 12]
total = sum(minutes)
report = f"Reading time: {total} minutes\n"
print(report, end="")
Path("reading-log.txt").write_text(report, encoding="utf-8")
With the file open, tap Run and look for Reading time: 55 minutes in the output. If your project already has a different run entry, use the local terminal in Pad Code AI to run python3 main.py from the project folder.
Open the generated file
The program runs in your project folder. When it finishes, reading-log.txt appears in the file list; open it to read the report. Change the list of numbers, run the script again and reopen the file to see the new total.
Find and fix a syntax error
Remove the closing bracket in minutes = [18, 25, 12], save and run again. Tap the diagnostic in the output to return to the reported location. Put the bracket back, then save and run to confirm the script works. For a runtime error that needs more investigation, tap a Python line number to set a breakpoint and inspect the variables when execution pauses.
Once downloaded, Linux and Python work without a connection. Installing more packages, for example pip install numpy in the terminal, needs the internet the first time. The app’s privacy policy describes optional connections. See the Pad Code AI page for other languages and tools.