[Tutor] Newbie Question: IDLE, is there a HOWTO use...

Kirby Urner urnerk@qwest.net
Fri, 30 Nov 2001 15:03:45 -0800


At 02:10 PM 11/30/2001 -0800, Frank Peavy wrote:
>So far, I have used the IDLE to edit py's but it seems that
>there is more to it than that.
>Is there a HOWTO for the use of IDLE?

Have you used IDLE as a calculator?  This is how the Python
tutorial starts as I recall (the one that comes with it).

  >>> 1 + 1
  2

  >>> import.math
  >>> math.log10(100)
  2.0

stuff like that.

The next step is to keep some of your results stored in
variables:

  >>> a = 1 + 1
  >>> b = math.log10(100)
  >>> a + b
  4.0

The next step is to write a function and run it:

  >>> def adder(a,b):
          return a + b

  >>> adder(3,4)
  7

Now you're off and running.  Explore string functions,
goof off, and then, if you start getting functions you
want to keep for next time, cut and paste 'em to an
open text Window (IDLE's editor) and save 'em as a
.py file.  Group together functions that do similar
things, so it makes sense to have 'em in the same file.
Voila, you've written a Python module.

Class dismissed.

Kirby