The code in the following screenshot demonstrates almost all the PEP 8 formatting recommendations:
I'll now walk us through the recommendations one by one:
- PEP 8 recommends that a single line of code should not exceed a width of 79 characters
While this is consistent with displaying the code on a standard text mode interface, the primary reason for this rule in the modern world of widescreens and resizable windows is that it helps with reading. Even in contexts that have nothing to do with programming, layout designers prefer to limit line width.
- Import statements should be placed at the top of the file, with ...