Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Fibonacci sequence is defined in the following way: Start out with F0=1 and F1=1. To calculate the nth Fibonacci number, where n>1, add up

image text in transcribedimage text in transcribedimage text in transcribed

The Fibonacci sequence is defined in the following way: Start out with F0=1 and F1=1. To calculate the nth Fibonacci number, where n>1, add up the two previous numbers. Mathematically we'd write: Fn=Fn1+Fn2 For some examples, F2=1+1=2,F3=2+1=3,F4=3+2=5,F5=5+3=8 Write a program which: 1) Inputs an integer (N). 2) Find the Fibonacci number that is greater than or equal to the entered number. For instance, when N=31,F8=34, so we should output: F8 =34 which is greater than or equal to 31 When N=233, we should print: F12 =233 which is greater than or equal to 233 For instance when N=1, we should print: FO=1 which is greater than or equal to 1 Sample Output: linux[34]\$ python 3 reach_fib.py What number should we exceed? 1 F0 1 which is greater than or equal to 1 linux[35]\$ python 3 reach_fib.py What number should we exceed? 123 F11 = 144 which is greater than or equal to 123 linux[36]\$ python 3 reach_fib.py What number should we exceed? 71526 F24 =75025 which is greater than or equal to 71526 linux[37]\$ python 3 reach_fib.py What number should we exceed? 3 F3 =3 which is greater than or equal to 3 linux[38]\$ python 3 reach_fib.py What number should we exceed? 531 F14 =610 which is greater than or equal to 531 linux[38]\$ python 3 reach_fib.py What number should we exceed? 12345 F21 = 17711 which is greater than or equal to 12345 Forbidden Built-ins/Methods/etc This is not a complete listing, but it includes: - list slicing - Declaring your own Functions - Dictionaries creation using dict(), or \{\} , copying using dict (other_dict) .get(value, not_found_value) method accessing, inserting elements, removing elements. - break, continue - methods outside those permitted within allowed types for instance str.endswith list.index, list.count, etc. - Keywords you definitely don't need: await, as, assert, async, class, except, finally, global, lambda, nonlocal, raise, try, yield - The is keyword is forbidden, not because it's necessarily bad, but because it doesn't behave as you might expect (it's not the same as ==. - built in functions: any, all, breakpoint, callable, classmethod, compile, exec, delattr, divmod, enumerate, filter, map, max, min, isinstance, issubclass, iter, locals, oct, next, memoryview, property, repr, reversed, round, set, setattr, sorted, staticmethod, sum, super, type, vars, zip - If you have read this section, then you know the secret word is: argumentative. - exit() or quit() - If something is not on the allowed list, not on this list, then it is probably forbidden. - The forbidden list can always be overridden by a particular

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

More Books

Students also viewed these Databases questions

Question

09 Administer internal and external privacy policies. Knowledge of:

Answered: 1 week ago

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago