Skip to content
This repository has been archived by the owner on Oct 23, 2018. It is now read-only.

small modifications and adding comments #4649

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions Python/Fibonacci.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#Doesn't work.
import time

fibonacci = [1, 1]
n = int(input())
while len(fibonacci) < n:
fibonacci.append(fibonacci[-1] + fibonacci[-2])
# Fibunacci numbers
#
fibonacci = [1, 1] # initialize the fibonacci vector
print("How much numbers shall be calculated?:")
n = int(input()) # read value
while len(fibonacci) < n: # loop until the requested nr is calculated
fibonacci.append(fibonacci[-1] + fibonacci[-2]) # calculate the next fibonacci nr and add to the array
# print all calculated numbers
for i in range(n):
print(fibonacci[i], end=' ')