[Tutor] Interactive programming.

Kent Johnson kent37 at tds.net
Wed Jan 7 18:08:17 CET 2009


On Wed, Jan 7, 2009 at 11:46 AM, WM. <wferguson1 at socal.rr.com> wrote:
> IDLE 2.6
>>>> i = 1
>>>> j = 11
>>>> if  j > 1:
>        print j
>        else:
>
> SyntaxError: invalid syntax
>>>>
>
> I am getting a little dizzy here.
>
> I know about text editor, code, save, F5.
>
> Many tutorials say that it is funner and faster to test an idea
> 'interactively', using IDLE.  Nothing is said about fiddling the output.
>
> In the above bit the 'else' is in the wrong place because IDLE or PYTHON
> terminated the script.

You have to backspace before typing 'else:' to remove the (automatic)
block indentation. IDLE auto-indents after the 'if:' and it will
continue to indent each line until you tell it to stop by backspacing
over the indent.

Kent


More information about the Tutor mailing list