Python Challenge Editor Python 3 import sys for line in sys.stdin: print(line, end="") Fibonacci Series Programming challenge description: The Fibonacci series is defined as F(0) = 0; F(1) = 1; F(n) = F(n-1) + F(n-2) where n>1. Given a positive integer n, print the value of F(n). Input: Your program should read lines of text from standard input. Each line will contain a single positive integer, n. Output: For each input n, print to standard output the fibonacci number, F(n), one per line. Test 1 Test Input 5 Expected Output 5 Test Case Output No results to display. Click code. Test 2 Test Input 12 Expected Output 144
Added by Heather U.
Close
Step 1
That is, F(0) = 0, F(1) = 1, and F(n) = F(n-1) + F(n-2) for n > 1. Show more…
Show all steps
Your feedback will help us improve your experience
Aarya B and 99 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
$f_{n}$ is the $n$ th Fibonacci number. Show that $f_{n+1} f_{n-1}-f_{n}^{2}=(-1)^{n}$ when $n$ is a positive integer.
Induction and Recursion
Recursive Definitions and Structural Induction
$f_{n}$ is the $n$ th Fibonacci number. Show that $f_{0}-f_{1}+f_{2}-\cdots-f_{2 n-1}+f_{2 n}=f_{2 n-1}-1$ when $n$ is a positive integer.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD