Where to go from here? newbee

Cousin Stanley CousinStanley at hotmail.com
Thu Jan 1 13:19:53 EST 2004


Richard ....

    A good way to get started with Python
    is to use the interpreter in command-line mode
    and experiment with it just by trying different things .... 

    Anything that works using the interpreter interactively
    will also work by coding the commands in a text editor
    and saving as a Python source file with the  .py  extension ....

    To execute a saved program, open a DOS window,
    and enter ....

        python someProg.py 

    You may have to include your python installation directory
    in the Windows  path  environment variable .... 

        set path=%path%;x:\yourPath\PythonXXX

    A sample interactive session follows .... 

    You can copy/paste it into a text editor,
    whack out the  >>>  and  ...  prompt characters,
    save it as a  .py  file, and then execute
    for a test ....

-- 
Cousin Stanley
Human Being
Phoenix, Arizona
    
>>>
>>> # Lines beginning with the pound sign
... # are comments ....
... #
... # Create some named objects
... # and bind these names
... # to their values
...
>>> root2 = 2**0.5
>>> r     = 42.0
>>> x     = r / root2
>>> y     = x
>>> z     = ( x**2 + y**2 )**0.5
>>>
>>>
>>> # Define a function to print objects
...
>>> def fprint( arg ) :
...     print '   ' , arg
...
>>> # Create a list of objects
...
>>> list_objects = [ r , x , y , z ]
>>>
>>> # Print the objects
...
>>> for this_object in list_objects :
...     fprint( this_object )
...
    42.0
    29.6984848098
    29.6984848098
    42.0
>>>
>>>




More information about the Python-list mailing list