Course Home | Assignments | Computing Resources | Data Sets | Lab Hours/Tutoring | Python | Schedule | Submit

Saint Louis University

Computer Science 1020
Introduction to Computer Science: Bioinformatics

Michael Goldwasser

Spring 2018

Computer Science Department


Python is an open-source programming language that is freely-available for all major computing platforms. Something to be aware of is that there are two major versions of Python currently in use. The first is the Python 2.x line. A more recent release is a Python 3.x line, and this version is not backward compatible with the former. We will be using the 2.x line in this course, because it still remains the one that is more prominently used as of today, and several supporting libraries have not yet been ported to the Python 3.x line.

Installying Python

If you are using your account on our department's hopper system, or our labs in Ritter Hall, Python is already installed on those machines.

It is also relatively easy to install Python on your own computer. In fact, if you have an Apple computer, Python2 is already pre-installed as part of the OSX distribution. For other platforms, you can download a Python installer from; make sure to download the Python 2.x line (Python 2.7 is the most current release).

Running Python

The Python interpreter is a piece of software that you run on the operating system in order to interpret Python commands that you type or Python source code that you have saved in a file. There are two typical ways that you can execute the interpreter:

For the most user-friendly experience, we recommend using IDLE for all your Python development, because it provides an integrated text editor that can highlight Python syntax, and because its menus allow for some convenient integration with other aspects of the language. Depending on your system, you might be able to find a menu item for IDLE in a typical "start" menu, or to set your operating system to associate IDLE as the application that should be launched when double-clicking on Python code saved with the conventional .py filename suffix. On our systems, IDLE3 is currently installed in the applicaiton menu, but IDLE2 can be launched by typing the sole command

at a terminal console. Similarly, on OSX, you will want to open a terminal console and type the command, idle.

We note that there is a bit of an inherent slowdown when running Python programs within IDLE rather than directly in the interpretter, so for large-scale computations it is often helpful to know how to run a script directly. This can be done through a typical commandline interface in a terminal window (or command prompt on Windows). You can start the Python interpreter without a script using the simple terminal command

or you can have it immediately execute an existing script, such as, with the terminal command
That will cause the script to run to completion and then end the python process. However, this above command is only recognized if you're Python installation installed the python command within your default "path". That will already be the case on most OSX/Linux systems, but it is not done automatically for Windows. You can instead adjust your path variable in user settings, or you can instead give a fully-qualified address of where that Python command is found (which depends on your system), but might be something usch as

Finally, on any system the above command also assumes that you're current working directory is the one in which the file is found. Uusually when you start a new terminal console the working directory is your home directory. You can change directories using the command cd, using a syntax perhaps such as

  cd Desktop/csci1010
if it were the case that were stored nested within a folder Desktop/csci1010 or adjusted to whereever you chose to save your script.

Interactive Web Site

There is a wonderful web site named that allows you to walk through the execution of a Python program, step-by-step, with a visual display of the current work space.

Michael Goldwasser
CSCI 1020, Spring 2018
Last modified: Friday, 09 March 2018
Course Home | Assignments | Computing Resources | Data Sets | Lab Hours/Tutoring | Python | Schedule | Submit