Introduction
In this chapter, we discuss how to use Python to perform some basic encryption by scrambling letters. This will introduce some basic string manipulation, user input, progressing on to creating reusable modules, and graphical user interfaces.
To follow, we will create some useful Python scripts that can be added to run as the Raspberry Pi boots or an easy-to-run command that will provide quick shortcuts to common or frequently-used commands. Taking this further, we will make use of threading to run multiple tasks and introduce classes to define multiple objects.
As it is customary to start any programming exercise with a Hello World example, we will kick off with that now.
Create the hellopi.py
file using nano
, as follows:
nano -c hellopi.py
Within our hellopi.py
file, add the following code:
#!/usr/bin/python3 #hellopi.py print ("Hello Raspberry Pi")
When done, save and exit (Ctrl + X, Y, and Enter). To run the file, use the following command:
python3 hellopi.py
Congratulations...