need help regarding compilation

Diez B. Roggisch deets at nospam.web.de
Thu Feb 23 12:17:18 EST 2006


fidlee at gmail.com 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)

You really have a book about python that doesn't mention that functions
definitions are closed by a colon? I doubt that...

Try this:

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

regards,

Diez



More information about the Python-list mailing list