Python is an interpreted, object-oriented, high-level programming language with dynamic data types.
The Python3 environment is pre-installed on the Raspberry Pi, so I won’t introduce how to install it here!
In Python, Python code entered in interactive mode is executed immediately and the results are output.
xxxxxxxxxx
Good for quickly trying out and testing code
Enter the python command on the command line or terminal to enter interactive mode:
xxxxxxxxxx
python
Press Ctrl+Z or enter exit() to exit this mode!
By writing a Python script file (with the .py suffix), you can save multiple lines of code in the file, and then execute these codes through tools such as the command line or an integrated development environment (IDE).
Create new folders and files
xxxxxxxxxx
mkdir Demo_Python
cd Demo_Python/
nanoHelloWorld.py
-Write source code
x# This is the first program
print("HelloWorld")
Hold down Ctrl+X, enter Y, then press Enter to save and exit!
Run the .py file
Enter python <file_name> in the terminal
xxxxxxxxxx
pythonHelloWorld.py
Jupyter Lab is a web-based interactive development environment that supports multiple programming languages.
xxxxxxxxxx
The content of Jupyter Lab is introduced later. Here we only demonstrate a simple routine. For detailed introduction, you can jump to the [Jupyter Lab Programming] tutorial.