diff --git a/Python/Fibonacci.py b/Python/Fibonacci.py index 861f5e4cf..cb46d0acf 100644 --- a/Python/Fibonacci.py +++ b/Python/Fibonacci.py @@ -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=' ')