Answer to Question #344489 in Python for Kian

Question #344489

Create a Python script that will display the next 5 numbers in the sequence where each number is the sum of the previous two.


TEXT FILE


8 3


4 5


6 2


Output


8 3 11 14 25 39 64


4 5 9 14 23 37 50


6 2 8 10 18 28 46

1
Expert's answer
2022-05-24T13:57:46-0400
a, b = map(int, input().split(' '))


result_list = [a, b]
for _ in range(5):
    c = a + b
    a = b
    b = c
    result_list.append(c)


print(" ".join(map(str, result_list)))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS