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
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