Unit 2 Task 40 - Solution

Learn to code with step-by-step lessons. A place for students to work through programming fundamentals and build skills.

Solution - Task 40: Fibonacci rabbit pairs (small n)

← Back to task


One possible program:

term_count = int(input("How many Fibonacci terms: "))
previous_term = 1
current_term = 1

for term_index in range(term_count):
    print(previous_term)
    previous_term, current_term = current_term, previous_term + current_term