On Sat, 2008-04-19 at 16:06 -0400, bob gailer wrote:
> kinuthia muchane wrote:
> > Hi,
> >
> > I do not know what I am doing wrong. When I run the following code from
> > the Python prompt it executes without a murmur. But when I save it as
> > a .py file and try to execute it from the shell, it just returns the
> > prompt...actually it is all scripts that return a value which  are
> > behaving in this manner.
> >
> >
> > def factorial(n):
> >     if n <= 1:
> >       return 1
> >     else:
> >       return n * factorial(n-1)
> >
> > factorial(some number here)
> >
> >   
> print factorial(some number here)
> 
> When you enter an expression at the interactive prompt you see the 
> value. Not true when you run a program. Expression values must be 
> printed. So you are doing nothing wrong.
 
Thanks, Bob, it worked the first time. It was staring me in the face the
whole time! Thanks once again.

Kinuthia...

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to