Search for question
Question

Question #2 Using Python's string capabilities, loops, lists, and built-in functions, write the code for a Python user-defined function that displays 'n' rows of a Fibonacci sequence! The function prototype MUST

be: def draw_fibonacci (n) A Fibonacci sequence begins with the values 0 and 1 and each subsequent term in the sequence is comprised of the sum of the 2 previous terms. Each new value to display is separated from the previous value by a space and then the expression "ratio: n.xxxxxx" (where n.xxxxxx) represents the the ratio of the last term divided by the second last term. NOTE: Be careful of division by zero on the first term! For example, a 9 row Fibonacci sequence would be: 0 ratio: 0.000000 0 1 ratio: 0.000000 0 1 1 ratio 1.000000 0 1 1 2 ratio: 2.000000 0 1 1 2 3 ratio: 1.500000 0 1 1 2 3 5 ratio: 1.666667 0 1 1 2 3 5 8 ratio: 1.600000 0 1 1 2 3 5 8 13 ratio: 1.625000 0 1 1 2 3 5 8 13 21 ratio: 1.615385

Fig: 1