human
Sum of all mersenne numbers present in an array | Function that returns true if n is a Mersenne number.
Function to return the sum of all the Mersenne numbers from the given array.
To store the required sum.
If current element is a Mersenne number.
Driver code"
How can the above be solved in Python?

=====
What is a code to sum of all mersenne numbers present in an array and the other steps required?
assistant
#Here is code to sum of all mersenne numbers present in an array and the other steps required.
 def isMersenne ( n ) :
	while ( n != 0 ) :
		r = n % 2 ;
		if ( r == 0 ) :
			return False ;
		n //= 2 ;
	return True ;
def sumOfMersenne ( arr , n ) :
	sum = 0 ;
	for i in range ( n ) :
		if ( arr [ i ] > 0 and isMersenne ( arr [ i ] ) ) :
			sum += arr [ i ] ;
	return sum ;
if __name__ == " _ _ main _ _ " :
	arr = [ 17 , 6 , 7 , 63 , 3 ] ;
	n = len ( arr ) ;
	print ( sumOfMersenne ( arr , n ) ) ;