WEEK01: intro to python, unix, cs21 ----------------------------------- M: Welcome to CS 21, about the course, etc OVERVIEW: - write lots of computer programs, learn some CS along the way - learn PYTHON programming language - labs/programs due every week - meant for students without any CS/programming experience - attending lab sessions is REQUIRED this year ALGORITHM EXAMPLE: can you solve sudoku puzzles? http://en.wikipedia.org/wiki/Sudoku can you write out a list of step-by-step instructions that anyone could follow, that would allow them to solve a sudoku puzzle?? an algorithm is like a recipe or list of instructions to follow Here's a simple algorithm for solving some sudoku puzzles:

- given a number (like 6) and a region (like the top left corner)
- rule out any rows that have 6's already in them
- rule out any columns that have 6's already in them
- if there's only one open space left, it must be where the 6 goes in this region, so put the 6 in that open box

Here's an example of this simple algorithm applied to an easy puzzle:

- consider the top left region

- rule out any 6's in rows

- rule out any 6's in columns

- only one open box left, so 6 must go there!

To SOLVE the above puzzle, we need to apply that algorithm: - to every region, given a number (ex: 6) - for every number from 1 - 9 - and we might have to repeat the process (for every region, for every number 1-9) a few times (each time you fill in a box, that eliminates options for other numbers) Computer Science & Algorithms: is it the "best" algorithm?? what do we mean by "best"?? is it the fastest algorithm? is it the simplest algorithm? is it in a form that the computer can understand? does it work for all sudoku puzzles? Good EXAMPLE: - the above problem is a good example of what we will be doing this semester: solve a problem ourselves, then turn that solution into an algorithm, then write/express that algorithm in PYTHON so the computer can do it - also a good example of the type of program you should be able to write by the end of this course - all programs (like the one above) have the following basic components: input/output (initial puzzle, results/solution) looping (repeat for all regions, repeat for all nums 1-9) branching (if there's only one open box, do this; otherwise, do that) data structure (need some way to say where each number is in the puzzle, what numbers are in a given row, column, region, etc) all tied together with an algorithm... COURSE INFO: intro to cs, learning to program, learn to develop and analyze algorithms (lots of problem solving) who should you take this course: students new to CS and programming (if you've already done some programming, CS31 or CS35 might be better for you) what to expect - class builds on previous week's work - does require work (lab time) - help is available (ninjas)...but START EARLY - my teaching style (learn by doing) - why python?http://xkcd.com/353

http://sebsauvage.net/python/snyppets/#beginner

unix login and first python program (print "hello") - cs account - let me know if name not correct - prox tags - passwd - dock and terminal program and unix prompt - logging out, ssh access (putty, mac) LAB0: vimtutor, using unix, update21, handin21 (due this Saturday)