Style Guidelines

The following simple rules are required for all i206 programming assignments. You must follow these conventions to receive full credit on your assignments. (Don’t worry, they are easy and make everyone’s life easier.)

1. The first line of all of your python programs must be:

#! usr/bin/env python

(The #! part is known as the shebang.) You must include it because it allows us to run your assignments unambiguously from a command line. (i.e.: fewer headaches for everyone). It’s also considered good form.

2. Set your first and last name in the __author__ special attribute at the top of each python file you hand in (required so we know who you are). (See the example identification section below for what it should look like).

3. Set your email in the __email__ special attribute (required so we can contact you).

4. Set your python version in the __python_version (private) attribute. You can discover your python version by typing this at the command line:

python --version

Or by typing this at the command line:
python
import sys
print sys.version

5. __can_anonymously_use_as_example specifies whether or not we can use your code, (or portions of your code) anonymously on the course blog or during in-class code reviews. Sharing your code helps everyone learn. If you do NOT want us to use your code anonymously (or otherwise), set this variable = False (see example). Otherwise, set it to True. Or omit it, and we will assume you “opt-in” (which we hope you will do).

Example header of a python program:

#! /usr/bin/env python 

__author__ = 'Great Student'
__email__ = 'gstudent@ischool.berkeley.edu'
__python_version = '2.6.4'
__can_anonymously_use_as_example = True

6. Use descriptive variable names in your programs (never use single letter names except for loop iterators). (This makes it easier for us to follow your logic and potentially grant partial credit.)

7. Please limit your lines of code to 80 characters in width (or 80 columns) when possible. This allows for a clean hardcopy printout.

8. You must include sample output from your program when you hand it in. Do not forget!

9. Do your best to abide by PEP 8 style guidelines:http://www.python.org/dev/peps/pep-0008/. Following them is not required, but we strongly encourage their use. (Following them will make your code look professional and will also make your graders lives much easier.)

10. Files must be named according to the following convention:

<last_name>_<first_name>_a<assignment_number>.<file_extension> [all lowercase]

Example: doe_jane_a1.doc
If your homework contains multiple files, please zip them together and submit the zipped file.

11. Use the file upload utility http://blogs.ischool.berkeley.edu/i206s13/submission-page/ to submit your work. If you upload the same file more than once, only the last uploaded version will be stored. If, for some reason the upload utility does not work for you, email all TAs and cc the professor.

12. You must NOT use any 3rd party/external libraries or modules as part of your source code for any of your coding assignments. Please restrict yourself to using modules in the Python Standard Library for your assignments unless the assignment’s text overrides this. (This sets an even playing-field among students. It also allows freedom in your coding, while still focusing you on course learning goals. We hope this focus will help you to build confidence for when you work with libraries/modules after 206.)

Important: We will use the last-modified time of your most recently uploaded file as the timestamp for determining early/on-time/late submissions.

Important: If not otherwise specified, all assignments are due by 9:00AM on the due date.

Thanks everyone!