This is Exercise 1 of the Micro Python Tutorial.
The file main.py is special in MicroPython, in the sense that when you power-on the device and/or press the reset button, the main.py file is executed.
main.pyprint('hello world.') print("hello again.")
REPL stands for Read, Evaluate, Print, Loop. The REPL is how you interact with the Python Interpreter.
Unlike running a file containing Python code, in the REPL you can type commands and instantly see the output printed out. You can also use the REPL to print out help for methods and objects in Python, list out what methods are available, and much more.
We'll use the REPL to execute our main.py program. Depending on how you are using Python, you can access the REPL on a command line, using a command line application (like mpremote or rshell), or within the user interface of a Python IDE (Integrated Development Environment) like Thonny.
No matter how you get access to the REPL, once you see its command line you can type commands, hitting RETURN to execute them.
On Linux or the Terminal in Mac OS:
► python3 Python 3.10.12 (main, May 27 2025, 17:12:29) GCC 11.4.0 on linux Type "help", "copyright", "credits" or "license" for more information. >>>Or using rshell, let's execute our main.py script: