I'm trying to solve a Happy number algorithm problem
Look at my code:
class Solution:
def isHappy(self, n):
nums = str(n)
while len(nums)!=1:
result = 0
for num in nums:
result += int(num) * int(num)
nums = str(result)
if (nums == '1'): print("True")
else: print("False")
on the off chance that the total number of 1 is seven in the input, it has a mistake. like ["1111111, 10111111", "11101111", "11011111"]
these numbers must be True yet results are False.
I know it needs to rehash one more while loop however every time I attempt to fix my code, I got more errors...
I don't do not understand how to fix this code. could you give me a clue?