Question: creat function called ---- > #def natureSequence(fn, sn, n) : ===================== Write a function named 'natureSequence' that returns a floating point value and accepts 3

creat function called ---- > #def natureSequence(fn, sn, n) :

=====================

Write a function named 'natureSequence' that returns a floating point value

and accepts 3 integer values: 'fn', 'sn', and 'n'

and displays 'n' number of terms in a sequence where the first term is 'fn',

the second term is 'sn', and all subsequent terms are computed from the sum

of the 2 previous terms.

The function returns the value of the last term divided by the 2nd last term.

All terms are separated by a space EXCEPT that there is NO SPACE after

the last term. A new line is output before the function ends.

======================================

input:

rv = natureSequence(0, 1, 10)

rv = natureSequence(1, 3, 15)

output:

0 1 1 2 3 5 8 13 21 34

1.619047619047619

1 3 4 7 11 18 29 47 76 123 199 322 521 843 1364

1.6180308422301304

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!