human
Give me a code to check whether Array represents a Fibonacci Series or not and the other steps required given the following:
Check whether Array represents a Fibonacci Series or not | Returns true if a permutation of arr [ 0. . n - 1 ] can form a Fibonacci Series.
Sort array.
After sorting , check if every element is equal to the sum of previous 2 elements.
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to check whether Array represents a Fibonacci Series or not and the other steps required.
 def checkIsFibonacci ( arr , n ) :
	if ( n == 1 or n == 2 ) :
		return True ;
	arr . sort ( )
	for i in range ( 2 , n ) :
		if ( ( arr [ i - 1 ] + arr [ i - 2 ] ) != arr [ i ] ) :
			return False ;
	return True ;
if __name__ == " _ _ main _ _ " :
	arr = [ 8 , 3 , 5 , 13 ] ;
	n = len ( arr ) ;
	if ( checkIsFibonacci ( arr , n ) ) :
		print ( " Yes " ) ;
	else :
		print ( " No " ) ;