Your task is to calculate and write to a file the next Fibonacci numbers starting from a first and second Fibonacci number. The numbers n, first and second will be provided by the user. The name of the file you will print the n next Fibonacci numbers is output.txt and the format is each number should be printed on a new line. Assume that all input numbers will be provided by the user; and they will always be non-negative integers. The Fibonacci formula is provided in the image below. You must handle the input taking part too, and DO NOT WRITE ANY PROMPTS for the user while taking the input. F, = Fn-1+ F1-2, where Fo = 0, F¡ = 1 Check the examples for further clarification. Keep in mind that we will be grading your code not just based on these examples, but other cases as well, so try to write code which can handle all possible cases. Important: Note the extra line at the end of outputs. It is also okay if your solution does not have it, but automatic grading will show it as incorrect. If that happens to you, send me an email after grades are announced and I will update your grade. Warning: You are not allowed to use imports.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Description
Your task is to calculate and write to a file the n next Fibonacci numbers starting from a first and second Fibonacci number. The numbers n, first and second will be provided by the user.
The name of the file you will print the n next Fibonacci numbers is output.txt and the format is each number should be printed on a new line.
Assume that all input numbers will be provided by the user; and they will always be non-negative integers. The Fibonacci formula is provided in the image below.
You must handle the input taking part too, and DO NOT WRITE ANY PROMPTS for the user while taking the input.
F, = Fn-1+Fn-2,
where Fo = 0, F1 = 1
%3D
%3D
Check the examples for further clarification. Keep in mind that we will be grading your code not just based on these examples, but other cases as well,
so try to write code which can handle all possible cases.
Important: Note the extra line at the end of outputs. It is also okay if your solution does not have it, but automatic grading will show it as incorrect. If that happens to you, send me an email after
grades are announced and I will update your grade.
Warning: You are not allowed to use imports.
Examples:
INPUT
OUTPUT
1
2
3
1
8
1
13
8
Transcribed Image Text:Description Your task is to calculate and write to a file the n next Fibonacci numbers starting from a first and second Fibonacci number. The numbers n, first and second will be provided by the user. The name of the file you will print the n next Fibonacci numbers is output.txt and the format is each number should be printed on a new line. Assume that all input numbers will be provided by the user; and they will always be non-negative integers. The Fibonacci formula is provided in the image below. You must handle the input taking part too, and DO NOT WRITE ANY PROMPTS for the user while taking the input. F, = Fn-1+Fn-2, where Fo = 0, F1 = 1 %3D %3D Check the examples for further clarification. Keep in mind that we will be grading your code not just based on these examples, but other cases as well, so try to write code which can handle all possible cases. Important: Note the extra line at the end of outputs. It is also okay if your solution does not have it, but automatic grading will show it as incorrect. If that happens to you, send me an email after grades are announced and I will update your grade. Warning: You are not allowed to use imports. Examples: INPUT OUTPUT 1 2 3 1 8 1 13 8
# DO_NOT_EDIT_ANYTHING_ABOVE_THIS_LINE
A# DO NOT EDIT ANYTHING BELOW THIS LINE
with open("output.txt") as r:
print(r.read(), end="")
Transcribed Image Text:# DO_NOT_EDIT_ANYTHING_ABOVE_THIS_LINE A# DO NOT EDIT ANYTHING BELOW THIS LINE with open("output.txt") as r: print(r.read(), end="")
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Files and Directory
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education