Python
Python is a widely used, interpreted high-level programming language, which is in certain ways similar to C++ or Java, but allows more readable and shorter code. Its key distinction between other programming languages probably is the fact that whitespaces and indentation are used for code block delimitation.
Installation
The process of installing Python is somewhat similar to the previous one for Git.
Any code run on the bricks will be executed by version 3.9 of the Python interpreter.
If you need to invoke the binary manually, you can do so by running python3
.
Linux
sudo apt-get install python3
macOS
brew install python3
Windows
It is strongly recommended using the WSL (Dev > WSL)! After install you must follow the instructions for Linux!
Download the latest Python installer and make your way through the setup.
Make sure to add python executables to your Windows PATH (it’s an option during the installation).
Language Bindings
By default, there will be auto-completion for standard Python packages only. To enable support for the EV3 package you will have to install the ev3dev language bindings for Python. Pip will do this job for you. After installing pip, you can tell it to set up the language bindings by running:
pip3 install python-ev3dev
Make sure to install the bindings for version 1.x!
We don’t support version 2.x!
Editors & IDEs
After installing Python, you’re almost ready to start programming. However, you still miss a suitable editor to write code. We recommend using an editor that at least supports syntax highlighting (Dev > IDE and Editor).
The OS is a Linux distribution and thereby a Unix system. Users of older operating systems - for instance Commodore, DOS, OS 9 - and Windows must ensure, that newline is set to be LF (line feed) and not CR (carriage return), CR+LF, RS or some similar weird stuff.
Problems & Help
Most if not all issues can be resolved by referring to the Python3 documentation, asking or searching on stackoverflow or - as a final resort - asking your tutor.