Algorithms and Logic Javascript Hacks
Algorithms and Logic Javascript Hacks
def fib(n):
nums = []
for i in range(n):
if i == 0:
print("0")
nums.append(0)
elif i == 1:
print("1")
nums.append(1)
else:
print(nums[i-2] + nums[i-1])
nums.append(nums[i-1] + nums[i-2])
size = int(input("Select how many characters you want your sequence to be:"))
print("You have selected a list of " + str(size) + " numbers.")
print("Here is your list: ")
fib(size)
You have selected a list of this many numbers:
Here is your Fibonacci sequence: