I have been doing some Leetcode recently to prepare for interviews and I have recently come across a problem with my code. I was wondering what was wrong with this code and why my code will not return false when it is supposed to. Any help is appreciated.
def isHappy(n):
    num = [int(i) for i in str(n)]
    newSum = 0
    for i in num:
        newSum += i ** 2
    if newSum != 1:
        print('repeating')
        try:
            isHappy(newSum)
        except RecursionError:
            return False
    return True
print(isHappy(2))
