Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python question Program Requirements For part 1, you must write a single program with two functions: . fib(): Takes a single integer argument num.terms greater

Python questionimage text in transcribed

Program Requirements For part 1, you must write a single program with two functions: . fib(): Takes a single integer argument num.terms greater than or equal to 1 and for each of the num.terms terms of the Fibonacci sequence prints 1) the number of the term-i.e., 1, 2, 3..., 2) the corresponding Fibonacci number, and 3) the ratio of the current and previous Fi- bonacci numbers as shown below. The ratio, printed only for x1 and higher, is an approximation of the golden ratio 1.61803398875 main ( ) : Prompts the user for the number of terms s/he wants to find and calls fib ( ) i Enter the number of terms you want to find: 2 3 2 1 1.0 i Enter the number of terms you want to find: 9 3 2 1 1.0 43 2 2.0 s 4 3 1.5 6 5 51.66666666667 76 8 1.6 7 13 1.625 9 8 21 1.61538461538 9 34 1.61904761905 The last line of your program should be a call to main). Don't forget to include docstrings! How many terms are needed to obtain an approximation to the golden ratio accurate to 4 decimal places? Save your program as gold_ratio.py

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

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions

Question

Discuss all branches of science

Answered: 1 week ago