CS0008 Style Rules

Rules

In this course, you will be graded not only on whether your code works, but also on style. Here are some guidelines:

  1. Use Python style conventions for your function and variable names (pothole case: lowercase letters with words separated by underscores (_) or camelCase).

  2. Choose good names for your functions and variables. For example, num_bright_spots is more helpful and readable than nbs.

  3. Use a tab width of 4 or 4 spaces for indentation. The best way to make sure your program will be formatted correctly is never to mix spaces and tabs -- use only tabs, or only spaces.

  4. Put a blank space before and after every operator. For example, the first line below is good but the second line is not:

    b = 3 > x and 4 - 5 < 32
    b= 3>x and 4-5<32
  5. Write a docstring comment for each function.

    Your function comments must mention what, if anything, the function returns, and the purpose and type of each parameter as well as any restrictions on its value. The comment must be grammatically correct.

    Put a blank line after every docstring comment.

  6. Each line must be less than 80 characters long including tabs and spaces. You should break up long lines using \.