human
Happy Number | Utility method to return sum of square of digit of n.
method return true if n is Happy number.
initialize slow and fast by n.
move slow number by one iteration.
move fast number by two iteration.
if both number meet at 1 , then return true.
Driver Code"
How can the above be solved in Python?
 What is a code to happy Number and the other steps required?
assistant
#Here is code to happy Number and the other steps required.
 def numSquareSum ( n ) :
	squareSum = 0 ;
	while ( n ) :
		squareSum += ( n % 10 ) * ( n % 10 ) ;
		n = int ( n / 10 ) ;
	return squareSum ;
def isHappynumber ( n ) :
	slow = n ;
	fast = n ;
	while ( True ) :
		slow = numSquareSum ( slow ) ;
		fast = numSquareSum ( numSquareSum ( fast ) ) ;
		if ( slow != fast ) :
			continue ;
		else :
			break ;
	return ( slow == 1 ) ;
n = 13 ;
if ( isHappynumber ( n ) ) :
	print ( n , " is ▁ a ▁ Happy ▁ number " ) ;
else :
	print ( n , " is ▁ not ▁ a ▁ Happy ▁ number " ) ;