[Tutor] invalid syntax error in Run Run Module

Alan Gauld alan.gauld at btinternet.com
Thu Feb 18 13:16:04 EST 2016

On 18/02/16 14:10, Lisa Hasler Waters wrote:
> Alan,
> Thank you so very much! This worked perfectly! 
> Now, if you don't mind and you have the time, can you please elaborate
> on when we (we being Python novices) would use the /Shell/ vs when it
> is best to use the /Editor/? 

You need to use the editor any time you want to create a file that you
can run
outside of IDLE. Especially for anything more than a dozen lines long - its
much easier to edit in the editor than to try to recall all the lines
you typed
in the shell.

The >>> prompt is for experimenting, trying out ideas. Running the help()
command to read documentation etc. Anything interactive or temporary..

I often find when I'm working on a project that I'll be entering my code in
the editor but then want to find out how some module or function works.
I then switch to the shell, try it out interactively and once I'm
switch back to the editor to create the final code.

Another thing the shell is good for is informal testing of modules. You can
import them at the >>> prompt and then call the various functions/classes

Of course eventually you will want to learn about how to formally test code
too but for beginners the shell is often the best and most instructive and
fun  way to start with testing.

Alan G
Author of the Learn to Program web site
Follow my photo-blog on Flickr at:

More information about the Tutor mailing list