The Practice of Computing Using Python

Course Programming Standards

CS 1510

Introduction to Computing
Section 3

Fall Semester 2014


This document outlines the rules you should follow when you submit a programming assignment for grading. These rules will simplify the grader's job by standardizing the form and appearance of submissions. Any of these rules can be overridden by a particular assignment but, if the assignment doesn't say otherwise, follow each of them.

Forms of Submission

When you are asked to submit a set of files, you must submit them in two forms: electronically and hard copy.


Document each source file with a header block that includes the file's name, your name, the name of the file's original creator (if not you), and a modification history that lists the date of each change to the file and the change made.

Here's an example for a Python file:

    ## FILE:
    ## AUTHOR:   Eugene Wallingford
    ## DATE:     2014/07/21
    ## COMMENT:  Compute aggregate mileage from consecutive periods
    ##           at different average paces
    ## MODIFIED: 2014/07/23 by Eugene Wallingford
    ## CHANGE:   Added computation of total time

Your block need not look exactly like this, but it should contain the same information.


I do not require you to follow a lot of specific style rules, but I do ask you to follow several basic guidelines to improve the readability of your code.

  1. Indent your code to indicate that one expression is contained within another. This is essential regardless of the language you use. The standard increment of indentation in Python is two spaces.

    As you will learn, indentation is essential to the Python interpreter.

  2. Indent consistently. If you choose not to use a community standard for your chosen language, adopt a standard of your own and use it consistently throughout your code. Indent all sub-expressions the same number of characters. Indent all statement bodies the same number of characters. Be consistent within a single file and across multiple files. Adopt some conventions that you like, and stick with them.

  3. Use names that say what they name. For example, num_scores is a better name than n, and number_of_scores is better yet. By convention, we generally use single-letter variable names only as names of generic numbers and as the index variables on loops.

  4. Use standard Python typographic conventions:

If you have any questions about style, please ask.

Eugene Wallingford ..... ..... September 5, 2014