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
100+ Python Pattern Examples