The code below presents both recursive and non-recursive functions for calculating the tetration. $^35$ has $2185$ digits; $^52$ has 19729 digits.
import math
def tet(x, n):
""" Tetration, ^nx, by loop over decreasing exponent counter. """
if n == 0:
return 1
p = x
while n > 1:
p = x**p
n -= 1
return p
def tet2(x, n):
""" Tetration, ^nx, by recursion. """
if n == 0:
return 1
return x**tet2(x, n-1)
x, n = 5, 3
t = tet2(x,n)
print('tet({:d}, {:d}) = {:d}'.format(x, n, t))
ndigits = int(math.log10(t)) + 1
print('(a number with {:d} digits)'.format(ndigits))