2.1 Writing Python script and module files – syntax basics
The point of Python (and programming in general) is to create automated solutions to problems that involve data and processing. Further, the software we write is a kind of knowledge representation; this means clarity is perhaps the most important quality aspect of software.
In Python, we implement automated solutions by creating script files. These are the top-level, main programs of Python programming. In addition to main scripts, we may also create modules (and packages of modules) to help organize the software into intellectually manageable chunks. A script is a module; however, it has a distinct intent to do useful processing when started by the OS.
A key part of creating clear, readable Python files is making sure our code follows the widely adopted conventions.
For example, we need to be sure to save our files in UTF-8 encoding. While ASCII encoding is still supported by Python,...