Python program to Create a Fibonacci Sequence

x = abs(int(input("Insert range of sequence: ")))
f1 = f2 = 1
print(f1,f2,end=" ")
for y in range(x-2):
 print(f1+f2, end=" ")
 f1, f2 = f2, f1+f2

 

 

Output:

Insert range of sequence: 5
1 1 2 3 5

 

Insert range of sequence: 9
1 1 2 3 5 8 13 21 34

Subscribe For Daily Updates

100+ Python Pattern Examplespython pattern examples - star patterns, number patterns