Style Guide

To make your code easier to read, many textbooks and companies use a style guide that defines some of the formating rules that you should follow in your source code. In Python, these rules are very important, as the structure of your code is defined by the layout. We’ll learn more about that in a later module.

For this book, most of the examples will be presented using the guidelines in the Style Guide for Python . However, by default Codio used to use 2 spaces for an indentation level instead of 4, so that is the format that will be used in some examples in this book.

Google also provides a comprehensive style guide that is recommended reading if you’d like to learn more about how to format your source code.


Try It!

Codio also includes a special assessment that will validate the coding style of your code based on the Google style guide. Use the assessment below to make sure your solution to Exercise 1 meets the expected coding style standard.


We will also be enforcing this style on many projects and assignments in this class, so it is very important to become familiar with proper coding style!