Intro. to Programming : Fall 2017 -Online

Csci 1020 - Fall 2017 - August 21, 2017 : Setup

Requirements

  1. starID
    You should have your starID and password handy at all times. This is needed for email, D2L for course work and grades, and access to your records.
  2. email address
    You have a student email address when you are registered for any FDLTCC course, your star ID and password are needed in order to use it. Check your email at least daily. Know how to send email with attachments because this is how you submit programming assignments.
  3. suitable computer for Python programming and online course work
    A modern desktop or laptop machine with Microsoft Windows, an Apple Mac OS X machine, or a Linux machine will be fine. It may be technically possible to use some sort of phone or tiny pad device for programming assignments, but a larger display is extremely helpful so that you can open, view, and use multiple windows/programs at the same time. A keyboard is very helpful vs a tiny touch "keyboard" on a touch screen which disappears.
  4. Internet access for course D2L, email, the course website, and various online resources such as Python documentation.

FDLTCC Computers and Campus Internet Access

You can use campus machines.
  1. W205: Computer Lab : Open Mac and PC Lab
    The student open lab has Mac and Windows machines, and Python version 2.7 is installed on all of them.
  2. 208: Computer Lab : MS DOS (Windows machines)
    Some room 208 Windows machines have Python installed because ESRI GIS software requires Python.
  3. 227: Computer Lab : Mac
    Every Mac has Python installed.
  4. General-purpose classrooms with a computer and projector.
    These are usually Macs which can also be booted for Windows emulation. The Mac always has Python installed.
  5. FDLTCC Guest Internet Access
    There are about a dozen WI FI units to deliver Internet guest access campus-wide, so you can use your laptop on campus in most locations. You may have to install Python on your own machine, or on some campus laptops and pads.

Python from a Mac (Python is already installed)

  1. Click on the finder to open it. (Usually, the split square happy face on the left of the lower bar memu.)
  2. Click on Applications.
  3. Scroll down to Utilities and click it to see applications under Utilities.
  4. Click on Terminal.
    This is a command line terminal from which you enter commands a line at a time, and press the Return key after each line. You start a Python interactive session and IDLE from this Terminal.
Mac interactive Python session (can also be done in IDLE)
The terminal starts out with a user$ prompt on the left. You type a line command then press the Return key. An interactive Python session is started by entering "python" as below. Try the following session by entering the text in black and following each entry by pressing the Return key.
    user$ python
    >>> 
Mac IDLE session
IDLE is the application we will use to develop Python programs. It is not the fanciest development application. However, it is installed by default with Python, and it works the same on all machines so that you can move between Mac, Windows, and Linux on computers with Python installed and expect the same behavior.

First, open a Mac Terminal session exactly as above, but instead of entering "python", just enter "idle".
    user$ idle
The IDLE editor opens in a new window. Leave the Terminal open while using IDLE. Because the IDLE session is the same on all machines, this will be discussed separately for all.

Note that IDLE features an interactive Python session window. If you press the Return key within this interactive Python Window, you will see the >>> prompt appear. Thus, you can use IDLE for almost everything to do with Python in this course.

The menu for IDLE has options to create a now file (python program file ending in .py), open an existing python program, and run the program.

Python from Windows machines in FDLTCC Open Lab W205 and Room 208

Windows interactive Python session
Use can always the interactive Python window in IDLE, as below. Alternatively, you may find a Python (command line) menu option on some machines in the Open lab Windows machines. On Room 208 machines, there is a Python(command line) option under the ArcGIS menu.

Windows IDLE session
  1. Click on the menu window button in the very lower left corner.
  2. In the Search entry box, type "idle", then click on the Python IDLE result.
The IDLE editor opens in a new window. Leave the Terminal open while using IDLE. Because the IDLE session is the same on all machines, this will be discussed separately for all.

Note that IDLE features an interactive Python session window. If you press the Return key within this interactive Python Window, you will the >>> prompt appear. Thus, you can use IDLE for almost everything to do with Python in this course.

The menu for IDLE has options to create a now file (python program file ending in .py), open an existing python program, and run the program.

Interactive Python Session (all computers)

    >>> print "Hi"
    Hi
    >>> 16*8
    128
    >>> quit()
    $

IDLE Session (all computers)


Above is what IDLE looks like when you start it. This is IDLE on a Linux machine, and the Python version is 2.7.5 -- recent enough for our course purposes. The >>> prompt is active when IDLE begins. On some machines, you may have to press the Enter/Return key to get the >>> prompt to appear.

Note the menu bar with File, Edit, Shell, Debug, Options, Windows, and Help. Only a few of these are really needed. You create a Python program in IDLE by pressing New under File, and this opens a separate window.


The interactive shell above has been used to print Hi, multiply two numbers, and runs a small looping program.

Note that there are different colors used for the text. This is called syntax highlighting, and it is nice feature within IDLE which will not work in ordinary text editors like Word.

In general, never use a word processor like Word to write Python programs! Python programs are always plain text, and you will always save them with the file extension .py


Above, under File >> New, a program editor window was opened and positioned next to the IDLE interactive Python screen, a program was typed in the editor, Run >> Module was selected on the editor window and the file saved, then the program ran with interaction in the IDLE interactive window.

Note that the editor shows the file name and full path (directory and filename) at the top: p0.py - /home/ted/srend/p0.py

You can resize IDLE windows to suit your needs. For programming and work in this course, it is convenient to use a fairly large display and keep several application and web page windows open such as your D2L session, documents (assignments, reference web pages), and your IDLE editor and interactive Python window.

Python on Linux and Mac

Python is always installed on newer Macs with OS X. You probably should be using an older Mac for this course.

Because Python is needed for many basic functions in Linux, it is best to use a version already installed (which will probably be 2.7). If Python is not installed on your particular Linux distribution (Ubuntu, Red Hat, Centos, Gentoo, ...), it is a good idea to search for installation instructions specific for your Linux distribution and version number. is usually simple if one uses the default Python provided for a particular distribution and version, say Centos 7 .

Python on Windows

Most users needing Python have Windows machines, and Python is rarely installed on Windows. (FDLTCC Windows machines usually have it installed, but this is because ESRI GIS software requires Python 2.7 .) There are many ways to do it, and you should have both Python 2.7 and Tkinter installed for this course.

IMPORTANT! Download and install Python 2.7 version (not a 3.* or 3.6 version). You can probably use the 32 bit version for everything in class, but you should use the 64 bit version if you have a 64 bit machine--which is likely.

1. The Anaconda installation has everything and more such as an ipython notebook server. It is around 400MB though.
https://www.continuum.io/downloads

2. Activestate has long offered a free community edition of their Python version. These are around 200MB.
https://www.activestate.com/activepython/downloads

3. The Python Software Foundation offers a much smaller version at around 20MB which includes everything needed.
https://www.python.org/downloads/
Python 2.7.13 : https://www.python.org/downloads/release/python-2713/

I recommend option 3. above (python.org) because it requires much less room on disk. The first link is the python.org download page, and the second link is to the Python 2.7.13 version.

Directions for installation vary, but it the same sort of installation routine as installing any other kind of software on Windows. You will need an admin password to install for all users--which you have if you are installing on your own machine. Accepting the defaults during installation is usually a good idea, e.g. allow the installer to put python in the path.

After installation, you should see Python IDLE and Python (command line) selections available in the start menu. Exact menu items differ depending on which installation you choose.

You may see options about installing and using a different editor for Python programming development. To keep the course focused on doing one sure thing, we will just describe and use IDLE which comes stock in all installations.

I'll hazard a guess that most students will be installing Python for Windows. In any case, login to D2L when you are done and have tested your installation using interactive Python (as above) and opening IDLE. Create a thread under Python: setup (Communications >> Discussions) reporting your success and, perhaps, tips to share.
Content is neither approved nor reviewed by FDLTCC.