human
Count Set | Recursive function to find number of set bist in a number.
Base condition.
If Least significant bit is set.
If Least significant bit is not set.
Driver code.
Function call"
How can the above be solved in Python?
 What is a code to count Set and the other steps required?
assistant
#Here is code to count Set and the other steps required.
 def CountSetBits ( n ) :
	if ( n == 0 ) :
		return 0 ;
	if ( ( n & 1 ) == 1 ) :
		return 1 + CountSetBits ( n >> 1 ) ;
	else :
		return CountSetBits ( n >> 1 ) ;
if __name__ == ' _ _ main _ _ ' :
	n = 21 ;
	print ( CountSetBits ( n ) ) ;