Computer Science, asked by si2343775, 4 months ago

Write a program to create a tuple with first 5 numbers of the Fibonacci series

Answers

Answered by ravi2303kumar
2

Answer:

# Program to display the Fibonacci sequence up to 5 terms

# first two terms

n1, n2 = 0, 1

count = 0

print("Fibonacci sequence:")

while count < 5:

  print(n1)

  nth = n1 + n2

  # update values

  n1 = n2

  n2 = nth

  count += 1

Answered by prakharagrawal6055
0

Answer:

tup=()

a=0

b=1

for i in range(5):

   a,b=a+b,a

   tup+=(b,)

print("Tuple storing first five terms of fibonacci series is:",tup)

Explanation:

Similar questions