Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help with this IN PYTHON PLEASE! Program Requirements For part 1, you must write a single program called gold.ratio.py with two functions fib):
I need help with this IN PYTHON PLEASE!
Program Requirements For part 1, you must write a single program called gold.ratio.py 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.., 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 and higher, is an approximation of the golden ratio 1.61803398875 e main () : Prompts the user for the number of terms s/he wants to find and calls the void function fib() The program gives the following output (with input in boldface font) Enter the number of terms you want to find: 2 2 1 1.0 Enter the number of terms you want to find: 9 s 2 1 1.0 4 3 2 2.0 s 4 3 1.5 6 5 51.66666666667 68 1.6 s 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? Program Requirements For part 1, you must write a single program called gold.ratio.py 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.., 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 and higher, is an approximation of the golden ratio 1.61803398875 e main () : Prompts the user for the number of terms s/he wants to find and calls the void function fib() The program gives the following output (with input in boldface font) Enter the number of terms you want to find: 2 2 1 1.0 Enter the number of terms you want to find: 9 s 2 1 1.0 4 3 2 2.0 s 4 3 1.5 6 5 51.66666666667 68 1.6 s 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 placesStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started