Useful resources for python programming and debugging; these can be used for any programming assignments or the final project.
Google Sheet Resources: (HW1 only)
Python Resources:
We will be using Python3. Useful Pieces of the Python Standard Library (v3.7):
- Numeric Types
- Sequence Types
- Boolean Operations and Comparisons
- ``If'' and ``For'' Statements
- Dictionaries
- Reading and Writing Files
Earlier versions of this course allowed for students to use Python2 or Python3 on their machines.
- Python2 or Python3?
- Short Answer: Python2.7 is often still used for research because many Python modules are written in Python version 2. Python 3 is quickly becoming the standard version, and many packages now offer python3 distributions.
- Here's a great tutorial with examples explaining the differences between Python 2 and Python 3.
- Python2 and python3 are both available on the Macs in the ETC labs. Type
python
orpython3
and double check the version. Typequit()
to exit the interpreter.
- Instructions for installing Python on your personal machine.
- If you are using a Mac, python is probably already installed. You can update it to the latest version using this tutorial.
- If you are using a PC, Python is probably not yet installed. On the Python for Windows page, download the appropriate windows installation.
- Forgot some syntax? Have a bug?
- Make sure your Python Path is set correctly. See instructions below
- Double check your syntax with the Python Cheat Sheet.
- The online Python Tutor visualizes Python code and shows the memory tables (called "data frames") in an interactive, step-by-step fashion.
- This PDF slide deck from Bio131 covers most of the typical python concepts we will use.
- Useful Tabs to Spaces converter.
- Useful Pieces of the Python Standard Library [python2] [python3]
- Setting your Python Path. How does Python know where
random.py
is? What about one of the files your provide, such asgraphspace_utils.py
? When importing a module,- Python first looks in the current directory. If
graphspace_utils.py
is there, so it can be imported. - If the module (e.g.,
random.py
) is not in the current directory, then it will look in a list of previously-determined directory locations. - If the module is not in the list of locations, then Python will throw an error.
$PYTHONPATH
environment variable. If you have a directory that contains frequently-used modules (e.g., the directory containing the*_utils.py
scripts), you can add this directory to the$PYTHONPATH
variable. Instructions depend on your machine. - Python first looks in the current directory. If
New! Teaching Resources: These assignments are described in the 2018 SIGCSE publication. They are provided for free use under the Creative Commons License (CC BY-NC-SA). Summary of license is provided here.
- Lab1 Command Line: [instructions.pdf]
- HW1 Excel Assignment: [instructions.pdf] [starter.xslx]
- Lab2 Python Practice: [instructions.pdf]
- HW2 Python Practice: [instructions.pdf] [starter.py]
- Lab3 Reverse Complement Function: [instructions.pdf] [starter.py]
- HW3 Central Dogma: [instructions.pdf] [starter.py] [anna_functions.py] [challenge_starter.py] [anna_challenge_functions.py]