Beispiel #1
0
 def test_fib_recursive(self):
     self.assertEqual(fib_recursive(10), 55)
     self.assertEqual(fib_recursive(30), 832040)
 def test_fib_recursive(self):
     self.assertEqual(fib_recursive(10), 55)
     self.assertEqual(fib_recursive(30), 832040)
        return n
    for _ in range(n-1):
        sum=fib1+fib2
        fib1=fib2
        fib2=sum
    return sum

def fibonacci2(n):
    a, b = 0, 1
    for _ in range(n):
        a, b = b, a + b
    return a


n=20
print(fib_recursive(n))

n=100
print(fib_list(n))

n=100
print(fib_iter(n))


n=1000
print(finbonacci_iter(n))

print(fibonacci2(n))

#print(fibo_num_digits(n))