Just started, need help!

Peter Hansen peter at engcorp.com
Sat Dec 1 02:07:13 EST 2001


Kyle Thompson wrote:
> 
>   When I do an input command, I hit enter so I may then do the if and else
> command but when I hit enter it try's to run the input command. How do I
> make it not run when its being made and just run when I'm done with a part
> and want to run it?

The question is a little unclear, but it sounds like you are
expecting to be able to enter a series of commands *without*
each one being executed, and then type 'run' or something 
to start the program.

Python doesn't work that way.  At the interactive prompt
*each* statement you type is executed immediately so you
can see the results.

If you want to make a program for running later, you need
to use a text editor (even Notepad in Windows might do okay
for a start, but there are better options) to store the
commands, then save the file with a name like coolprog.py,
and then go to a command prompt (*not* the Python prompt,
but the one your operating system gives you) and type
a command like "python coolprog.py" which causes the
Python interpreter to compile and run the program.

(Use the interactive prompt for experimentation, but
use an editor, or IDLE, or PythonWin or something like
that for creating programs to save as files and run.)

By the way, when you are new, it helps to tell us what
operating system you are running and other such details
so the advice you get is a little more specific...

-- 
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com



More information about the Python-list mailing list