We decided that, being 3/5 thru the year, a bit of bi-linguality won't
do our CS1's any harm. We have thus started moving from ABC to Python
(and back). To me it is quite an exhilirating experience --- working
out `cheat sheets' to help them with translating, etc. We'll expect
them to transliterate some of the code segments in the ABC Handbook as
well. Python's `teachability' is being confirmed by this exercise, IMHO.
(CS1 is writing the first ABC vs Python test tomorrow morning.)
We are using PC-Python, and thus had to rediscover the usefulness of the
`raw' DOS command-line-editing function keys (F1..F6). Otherwise I'm
using QuickEdit as a front end to the interpreter.
There is one small fly (bug?) in the ointment though! When we try to
import the `string' module, the following happens:
Parsing error: file K:\Python\Lib\string.py: line 60:
j = i
^
Syntax error: invalid syntax
Here we have an assignment statement following directly on a `one-line' if:
...
if i==n: break
j = i
...
What makes me suspicious is the fact that I encounter a similar problem
in the following code segment:
from math import sqrt
def smallest_divisor(n):
if (n % 2 == 0): return 2
try = 3
while try <= sqrt(n):
if n % try == 0: return try
try = try+2
^
return n
print smallest_divisor(287)
Is there a work-around perhaps?
If anybody on the Python-list is interested in criticizing some of my
efforts, I would be quite happy to exhange ideas & handouts.
Regards,
Stoffel.