[Tutor] Tutor Digest, Vol 50, Issue 63
kinuthia muchane
muchanek at gmail.com
Sun Apr 20 10:00:57 CEST 2008
> "kinuthia muchane" <muchanek at gmail.com> wrote
>
> > 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.
>
> The >>> prompt evaluates expressions and prionts the value.
> The interpreter on the other hand does not automatically print
> values you ghave to explicitly tell it to print using the print
> statement.
>
> So in your case just add the print command in front of the
> function call and all will be well.
>
> > factorial(some number here)
>
> print factorial(n)
>
> HTH,
>
>
> --
> Alan Gauld
Thanks, that worked.
Kinuthia...
More information about the Tutor
mailing list