Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

What you wrote works. You were just missing a colon after else.

def a(n):
    if n==1:
        return 1
    else:
        return a(n-1)+1/a(n-1)^2