Sum of Fibonacci Numbers | Set 2 | Python program for the above approach ; Function to find the sum of first N + 1 fibonacci numbers ; Apply the formula ; Prthe result ; Driver Code
import math NEW_LINE def sumFib ( N ) : NEW_LINE INDENT num = round ( pow ( ( pow ( 5 , 1 / 2 ) + 1 )   \ / 2.0 , N + 2 ) / pow ( 5 , 1 / 2 ) ) ; NEW_LINE print ( num - 1 ) ; NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT N = 3 ; NEW_LINE sumFib ( N ) ; NEW_LINE DEDENT