Re: [brython] Syntax error in factorial

14 views
Skip to first unread message
Message has been deleted

Billy Earney

unread,
Sep 29, 2016, 8:28:05 AM9/29/16
to bry...@googlegroups.com
if this is running under python 3.x  you must have 'print(factorial(4))'  instead of 'print factorial(4)'


On Thu, Sep 29, 2016 at 7:17 AM, <roberci...@gmail.com> wrote:
Why in this code:
def factorial(n):
   
if n <1:   # base case
       
return 1
   
else:
       
return n * factorial( n - 1 )  # recursive call
       
print factorial(4)



I have error:

File "__main__", line 8
   
print factorial(4)
SyntaxError: invalid syntax



I want to do factorial recursive

--
You received this message because you are subscribed to the Google Groups "brython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brython+unsubscribe@googlegroups.com.
To post to this group, send email to bry...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brython/4f036755-efe4-4f10-ad46-5c739fe7eb00%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
Message has been deleted
0 new messages