human
Count set bits in an integer | Function to get no of set bits in binary representation of positive integer n.
Program to test function countSetBits"
Solution in Python:
assistant
#Here is code to count set bits in an integer and the other steps required.
 def countSetBits ( n ) :
	count = 0
	while ( n ) :
		count += n & 1
		n >>= 1
	return count
i = 9
print ( countSetBits ( i ) )