Back to Practice Dashboard
Python BasicsEasy

Find the Nth Term of the Fibonacci Series

Learn how to solve the 'Find the Nth Term of the Fibonacci Series' problem. This detailed resource details brute force and optimized approaches.

Problem Statement

Easy

Write a function fibonacci_nth(n) that takes a positive integer n and returns the nth term of the Fibonacci series (1-indexed). The series is: F(1) = 0, F(2) = 1, F(3) = 1, F(4) = 2, F(5) = 3, ...

Constraints
  • 1 <= n <= 50

Examples

Example 1
Input
n = 5
Output
3
Explanation

The 5th Fibonacci term is 3. The series: 0, 1, 1, 2, 3.

Example 2
Input
n = 1
Output
0
Explanation

The 1st Fibonacci term is 0.

Example 3
Input
n = 10
Output
34
Explanation

The 10th Fibonacci term is 34. The series: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34.

Need a Hint?
Use simple arithmetic operators (like modulo `%`, division `//`), conditional checks, or loops to inspect number properties.
Edge Cases to Watch
  • Empty list or null input variables
  • Single item lists/arrays
  • Extremely large input bounds causing integer or stack overflow

Ready to Solve?

Open the problem in PyRun's browser-based Python editor. Your code runs fully offline — no server required.

Open in Editor