human
I am working on the file "Python/leetcode/easy/strings-arrays.ipynb".
The first task is:
Q.2. Write an algorithm to determine if a number n is "happy".
A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are happy numbers.
Return True if n is a happy number, and False if not.
Can you write Python program for it?

=====
Write me a Python program to determine if a number n is "happy"?
assistant
#Here is Python program to determine if a number n is "happy".

class Solution(object):
    def ifHappy(self, n: int) -> bool:
        """
        :type n: int
        :rtype: bool
        """
        l = 0
        while (n != 1):
            add = 0
            for i in str(n):
                add += int(i) ** 2
            n = add
            l += 1
            if l > 100:
                return False
        return True

print(Solution().ifHappy(19))