human
First string from the given array whose reverse is also present in the same array | Function that returns true if s1 is equal to reverse of s2.
If both the strings differ in length.
In case of any character mismatch.
Function to return the first word whose reverse is also present in the array.
Check every string.
Pair with every other string appearing after the current string.
If first string is equal to the reverse of the second string.
No such string exists.
Driver code"
How can the above be solved in Python?
 Can you provide a code to first string from the given array whose reverse is also present in the same array and the other steps required?
assistant
#Here is code to first string from the given array whose reverse is also present in the same array and the other steps required.
 def isReverseEqual ( s1 , s2 ) :
	if len ( s1 ) != len ( s2 ) :
		return False
	l = len ( s1 )
	for i in range ( l ) :
		if s1 [ i ] != s2 [ l - i - 1 ] :
			return False
	return True
def getWord ( str , n ) :
	for i in range ( n - 1 ) :
		for j in range ( i + 1 , n ) :
			if ( isReverseEqual ( str [ i ] , str [ j ] ) ) :
				return str [ i ]
	return " - 1"
if __name__ == " _ _ main _ _ " :
	str = [ " geeks " , " for " , " skeeg " ]
	print ( getWord ( str , 3 ) )