[Edu-sig] Using IDLE with students

kirby urner kirby.urner at gmail.com
Wed Aug 22 18:35:42 CEST 2007


> * Describe the Golden Mean and compare the (converging) computed ratios to
> the actual value. To compute the actual value, you must import the "math"
> module.
>
> Best to all,
> John

Note: you *may* import the math module, for sqrt, but remember pow is in
__builtins__ so (1 + pow(5, 0.5))/2 will work.

I liked your smooth transition from shell mode to Run in module mode
while keeping the shell open in __main__.  There's no restart in this
picture, we you're free to keep treating the module almost like a
generator in that it yields control back to the shell (after printing).

>From there it's a quick jump to explaining how a module might run
top level (as __main__), with no interactive session for a launch pad.
Put everything you'll need in the suitcase.  Just an empty hotel room
(Python interpreter + we hope Standard Library) on the other end.

Kirby


More information about the Edu-sig mailing list