Update fibonacci.py

This commit is contained in:
marina 2023-08-07 17:05:59 -07:00 committed by GitHub
parent 5d9313dd85
commit 9a820d8599
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,15 +2,9 @@
# -*- coding: utf-8 -*-
# author: bt3gl
def fibonacci(n):
""" Calculate the nth Fibonacci number """
if n == 0 or n == 1:
return n
return fibonacci(n - 1) + fibonacci(n - 2)
if __name__ == '__main__':
print('Testing fibonacci')
n = 10
print(f'Fibonacci of {n}: {fibonacci(n)}')