[EMAIL PROTECTED] wrote:
> i am new to learning jython...
> 
> 
> i just tried compiling a small piece of code that is given below:
> 
> def fac(x)
>  if x<=1:return 1
>  return x*fac(x-1)

This is invalid Python syntax.  Have you gone through the Python 
tutorial yet?  Doing so is probably a good idea if you haven't.

The problem is that "def" statements must be followed with a colon, like so:

def fac(x):
     if x <= 1:
         return 1
     return x * fac(x-1)

(Note the colon after "def fac(x)".  I've also taken the liberty of 
reformatting the code slightly make it more readable, but that isn't 
necessary to avoid the SyntaxError you were getting.)

-Peter

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to