Fwd: [Tutor] New function and 3 line program not working?

Liam Clarke cyresse at gmail.com
Thu Nov 11 08:27:37 CET 2004


Sweet as,

Using reply all replies to the list also. : )


---------- Forwarded message ----------
From: SunDragon <sundragon at cogeco.ca>
Date: Thu, 11 Nov 2004 00:33:07 -0500
Subject: Re: [Tutor] New function and 3 line program not working?
To: Liam Clarke <cyresse at gmail.com>


Liam,

Thank You for your repy.

I think I have found the solution to my problem.

When I first start up the IDLE gui, it is titled "Python Shell" and I was
attempting to enter everything here and I kept getting >>> after each line I
typed and it would not work.  But, I learned that if I open a new window
from the "Python Shell" and then enter everything, then save,  it would work
just fine.

Thank you again for your help

Tim Moffatt




----- Original Message -----
From: "Liam Clarke" <cyresse at gmail.com>
To: "SunDragon" <sundragon at cogeco.ca>; "Python Tutor" <tutor at python.org>
Sent: Wednesday, November 10, 2004 8:34 AM
Subject: Re: [Tutor] New function and 3 line program not working?

> You need to have in your file line.py the
>
> def newLine():
>          print
>
> before the next one. If you just do it in IDLE, IDLE executes it, but
> it doesn't save it anywhere your programme can access it, so your
> programme line.py has no idea what newLine() is.
>
>
> So, line.py should look like this -
>
> def newLine():
>      print
>      return
>
> print First Line."
> newLine()
> print "Second Line."
>
>
> Hope that helps.
>
> Liam Clarke
> On Wed, 10 Nov 2004 08:24:13 -0500, SunDragon <sundragon at cogeco.ca> wrote:
> >
> >
> > This is my first post, so HI all! and Thank You for you help!
> >
> > Below is a tutorial that I am trying to complete, but I can not
duplicate
> > this exercise in either the IDLE gui or command line. (ver 2.3.4)
> > Tutorial says to do this....
> >
> >  define the new function---- I go to IDLE gui and define the
function....
> >
> > def newLine():
> >      print
> >
> >
> > write the 3 line program---- I go open another IDLE window and like in
the
> > tutorial type this 3 line program....
> >
> > print "First Line."
> > newLine()
> > print "Second Line."
> >
> > I save it as line.py
> >
> > Now I am to see this output result upon running it....
> >
> > First line.
> >
> > Second line.
> >
> > But I dont get the output I should, I get the First Line. printed and a
> > syntax error
> >
> > >>>
> > First Line.
> >
> > Traceback (most recent call last):
> > File "C:/Python23/newLine.py", line 2, in -toplevel-
> > newLine()
> > NameError: name 'newLine' is not defined
> >
>
> --
> 'There is only one basic human right, and that is to do as you damn well
please.
> And with it comes the only basic human duty, to take the consequences.



-- 
'There is only one basic human right, and that is to do as you damn well please.
And with it comes the only basic human duty, to take the consequences.


More information about the Tutor mailing list