human
Sum of numbers with exactly 2 bits set | To calculate sum of numbers.
Find numbers whose 2 bits are set.
If number is greater then n we don 't include this in sum.
Return sum of numbers.
Driver Code"
Solution in Python:
assistant
#Here is code to sum of numbers with exactly 2 bits set and the other steps required.
 def findSum ( n ) :
	sum = 0
	i = 1
	while ( ( 1 << i ) < n ) :
		for j in range ( 0 , i ) :
			num = ( 1 << i ) + ( 1 << j )
			if ( num <= n ) :
				sum += num
		i += 1
	return sum
n = 10
print ( findSum ( n ) )