human
Write me a code to zeckendorf 's Theorem (Non and the other steps required given the following:
Zeckendorf 's Theorem (Non | Returns the greatest Fibonacci Number smaller than or equal to n ..
Corner cases.
Finds the greatest Fibonacci Number smaller than n ..
Prints Fibonacci Representation of n using greedy algorithm.
Find the greates Fibonacci Number smaller than or equal to n.
Print the found fibonacci number.
Reduce n.
Driver code test above functions"
How can the above be solved in Python?
assistant
#Here is code to zeckendorf 's Theorem (Non and the other steps required.
 def nearestSmallerEqFib ( n ) :
	if ( n == 0 or n == 1 ) :
		return n
	f1 , f2 , f3 = 0 , 1 , 1
	while ( f3 <= n ) :
		f1 = f2 ;
		f2 = f3 ;
		f3 = f1 + f2 ;
	return f2 ;
def printFibRepresntation ( n ) :
	while ( n > 0 ) :
		f = nearestSmallerEqFib ( n ) ;
		print f ,
		n = n - f
n = 30
print " Non - neighbouring ▁ Fibonacci ▁ Representation ▁ of " , n , " is "
printFibRepresntation ( n )