human
Check perfect square using addition / subtraction | This function returns true if n is perfect square , else false.
the_sum is sum of all odd numbers . i is used one by one hold odd numbers.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to check perfect square using addition / subtraction and the other steps required.
 def isPerfectSquare ( n ) :
	i = 1
	the_sum = 0
	while the_sum < n :
		the_sum += i
		if the_sum == n :
			return True
		i += 2
	return False
if __name__ == " _ _ main _ _ " :
	print ( ' Yes ' ) if isPerfectSquare ( 35 ) else print ( ' NO ' )
	print ( ' Yes ' ) if isPerfectSquare ( 49 ) else print ( ' NO ' )