You are viewing a single comment's thread. Return to all comments →
Seems like cookies are disabled on this browser, please enable them to open this website
Fibonacci Modified
You are viewing a single comment's thread. Return to all comments →
import math
import os
import random
import re
import sys
Complete the fibonacciModified function below.
def fibonacciModified(t1, t2, n):
for i in range (n-2):
nt=t1+t2*t2
t1=t2
t2=nt
return t2
if name == 'main':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
t1T2n = input().split()
t1 = int(t1T2n[0])
t2 = int(t1T2n[1])
n = int(t1T2n[2])
result = fibonacciModified(t1, t2, n)
fptr.write(str(result) + '\n')
fptr.close()