Tuesday, February 3, 2009

Project Euler: a good source of programming problems

Project Euler might be a good source of programming problems for a CS1 course.
"Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Although mathematics will help you arrive at elegant and efficient methods, the use of a computer and programming skills will be required to solve most problems."
The project was started in 2001 and now has 230 problems. Each one has a short description and can be solved by a computer program that runs in a minute or less on a modest computer. Here's an example of one of the problems (#5):
"2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.What is the smallest number that is evenly divisible by all of the numbers from 1 to 20?"
The site shows statistics (if you register) that show the programming languages used by people who have submitted solutions. Python is second only to C/C++ in the ranking.

Monday, February 2, 2009

Berkeley online study guide for learning Python

Berkeley has resources for "self-paced" study, including a course on learning Python.

This uses the online version of How to think like a computer scientist and has programming assignments, sample quizzes and quizzes. I found the site to be very slow to serve up pages for some reason.

Sunday, February 1, 2009

Use emacs as your Python IDE

Committed emacs users might take a look at a post by Ryan McGuire, Emacs as a powerful Python IDE, where he suggests how to set up your emacs environment for python hacking.
"A lot of people, for whatever reason, don't feel that Emacs is an IDE at all. I don't personally care what you define it as — the fact remains — Emacs is a powerful Python environment and despite being over 32 years old has proven to be just as modern as any IDE today, and remains THE most configurable editor (operating system?) ever."
The key enablers seem to be Pymacs, Rope, and Ropemacs.

Thursday, January 29, 2009

Python cheat sheet

If you are learning a programming language it's often useful to have a cheat sheet with a concise list of key information. You can find many on the Web for Python, but I think that the Python Refcard done by Michael Goerz is one of the best.
'It contains: variable types (numbers, sequences, sets, strings and regular expressions), basic syntax, object orientation and modules, exception handling, system interaction, input/output, standard library"
It is intended to be printed on one piece of paper (double sided) and is formatted for A4, but Adobe manages to shrink it to print on letter size paper and the source is available in ODT, if you want to fiddle with it.

We might consider creating one or more one-page cheat sheets for use in CMSC 201 next Fall.

Wednesday, January 28, 2009

Club ShowMeDo videos on learning Python

Club Showmedo videos on learning Python

The showMeDo site has a series of short screencast videos on learning Python. Access to most of these required a $60/year subscription fee, however.
"Are you learning Python? To keep the site running clean and ad-free we've started Club ShowMeDo. The club will allow you access to some special videos we're making to pass on programming skills we consider important to the development and enjoyment of Free Open Source Software (FOSS).

The focus at the moment is on developing with the Python programming language, one of the backbones of the FOSS movement with a huge number of included and third-party libraries."
I'm not sure how effective these screencasts are, but we might experiment with the idea for teaching cmsc201. Screen casts with narration are easy to do and could be a good way to augment lectures. We could have the instructors and TAs produce some and might accumulate a good collection over the years. These could be shared with colleagues at other Universities.

Crunchy frog python tutorials

Crunchy is a Python system that "formats and delivers html-written Python tutorials inside a browser window, adding interactive elements and snazzy navigation." The name, crunchy, is a Monty Python reference.

Once you have downloaded and installed crunchy on your local computer, you can view HTML pages that have special crunchy-tags that will interact with crunchy and Python. One of the most useful features is that you can embed a Python interpreter window in your HTML presentation. If you are using this as an instructor, you can immediately demonstrate Python concepts from your browser. If you are a student, you can do this and then explore variations on your own.

Security is one potential issue with crunchy. Since an HTML file can invoke python from the browser, you need to trust its source. The authors have clearly thought about this and put in place various mechanisms to help. But, AFAIK, Python does not have a "sandbox" mechanism like Java's, so some risk remains.

If we want to use crunchy for teaching and have students install crunchy on their own computers, we'll have to look carefully at the security issues to ensure we understand and minimize the risk.

If you want to learn more about crunchy, the best way is to install it and view the crunchy tutorial that comes with it.

Saturday, December 6, 2008

Guido van Robot

Guido van RobotGuido the Robot is a simulator designed to teach people the rudiments of programming in Python. It's based on the earlier Karel the Robot. It's probably too simple for CMSC201, but might be useful for an initial exercise of perhaps for CMSC100 or CMSC104. Students write simple programs in a subset of Python to control a robot as it moves around in a city consisting of a rectangular grid of streets (left-right) and avenues (up-down). The system is open sourced, available on sourceforge and still being developed.