Skip to the content.

SCHOOL RESOURCES ARCHIVE

All school related resources stored here. (maintained by Sujal Singh)

RESOURCE LIST


WAP to generate and display first n fibonacci numbers in a tuple.

"""
WAP to generate and display first n fibonacci numbers in a tuple.
"""
x, n1, n2 = int(input("Enter length of fibonacci series to be displayed: ")), 0, 1

print(f"Fibonacci series till {x}:", n1, n2, sep="\n")
for i in range(x):
    n1, n2 = n2, n1 + n2
    print(n2)

"""
OUTPUT:
Enter length of fibonacci series to be displayed: 10
Fibonacci series till 10:
0
1
1
2
3
5
8
13
21
34
55
89
"""


RAISE AN ISSUE ON GITHUB IF

WANT TO CONTRIBUTE RESOURCES?

Fork this repository, make changes, create a pull request.


Comments