fibonacci sequence in python
How to calculate Fibonacci sequence in Python.
Create a file called fib.py.
nterms = int(input("How many terms? "))
n1, n2 = 0, 1
count = 0
if nterms
Run it.
$ python fib.py
How many terms? 5
Fibonacci sequence:
0
1
1
2
3
Again.
$ python fib.py
How many terms? 10
Fibonacci sequence:
0
1
1
2
3
5
8
13
21
34