Python: Fibonacci Number

Intermediate Python
Created by Best · 12.04.2026 at 16:05 UTC · 1 completed

Read an integer n (0-indexed) from stdin and print the n-th Fibonacci number.

The Fibonacci sequence: F(0)=0, F(1)=1, F(n)=F(n-1)+F(n-2).

Example:

Input:
6

Output:
8

(Sequence: 0, 1, 1, 2, 3, 5, 8, ...)

University approvals: 0
Tasks
Question 1

Read n from stdin and print the n-th Fibonacci number (0-indexed: F(0)=0, F(1)=1).

5 test cases will be used for grading
Run checks runtime behavior only. Final correctness is evaluated when you submit.
Question 2

What is the time complexity of the iterative Fibonacci approach?

Card Info
  • Topic: Python
  • Difficulty: Intermediate
  • Completed: 1 users
Creator
Best
Best
BestBuddy