Intro to
Programming
with Python

Fall 2011
course
navigation

tuesday sep 6

Standard beginning : any questions about anything so far?

Expectations : 'welcome to my classroom' - Rob Jenkins, chronicle of higher ed

nuts'n'bolots

getting started

First, it's common for people taking this course to have very different experience levels.
If getting up and running is easy for you, great. I encourage you to brush up on your current skills, and try to stretch a bit wherever you feel you need it.
If all this is brand new, that's OK: get help as needed, and plug away at getting all the pieces in place.
Your first substantial task is to get to the point where you can write and run a python program on your computer. (Or, if you don't have a computer, on the lab computers. If so, please do check in with me.)
The basics look like this :
Here's the "hello world" program in python :
# This file is hello.py - a first short program in python. print "Hello world"
From a terminal program (the $ is the prompt waiting for you to type), in the same folder as the file (see below for more)
$ python hello.py Hello world!
You should get this working this week. If you need help, ask.

command line vs GUI

A bit more on the command line.
Mac/Unix: # Mac: The application is /Applications/Utilities/Terminal # Unix: depends; look for "Terminal" in application menu $ cd /folder/name # change directory $ ls # list directory $ pwd # print working directory $ python file.py # run python program in file.py Windows # XP: Start ... Programs ... Accessories ... Command Prompt > cd \folder\name # change directory > dir # list directory > cd # show current directory > python file.py # run python program in file.py

running python

And a bit more on running python.
In general, programming can be done with text editors and the command line (which is the "old school" way I'll be showing you) or with an IDE (Integrated Development Environment). Some people swear by IDEs. My opinion is that they hide the details of what's going on, and when you're starting out (like in this class), it's good to understand those details.
The difference between an editor and an IDE is essentially how much can be done from within the application to compile, run, debug etc the program. Or in larger settings, the programming project. If you think you'd rather try an IDE, the list at http://wiki.python.org/moin/PythonEditors may be helpful.
On a lab mac, run python by launching the "Terminal" program in Applications/Utilities. Then get to right folder, and type "python".
This can also be done over the network on cs.marlboro.edu - the same machine that's serving up these web pages. The "ssh" (secure shell) program can connect you to your_username@cs.marlboro.edu (after I give you an account; ask if you want one).

an example

Demo the chaos program

discuss overview of computers and terminology

random

chap 2 topics

... if we get that far
http://cs.marlboro.edu/ courses/ fall2011/python/ notes/ sep_6
last modified Monday September 5 2011 10:28 pm EDT