1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Tanya [424]
3 years ago
14

Using Python, Write a function whose input is which term of the fibonacci sequence the user would like toknow, and whose output i

s that term in the fibonacci sequence. For example, ifyou called your function Fib, Fib(1) = 0, Fib(2) = 1, Fib(3) = 1, Fib(4) = 2,and so on.
Computers and Technology
1 answer:
Alika [10]3 years ago
4 0

Answer:

#here is code in python

#recursive function to find nth Fibonacci term

def nth_fib_term(n):

#if input term is less than 0

if n<0:

 print("wronng input")

# First Fibonacci term is 0

elif n==0:

 return 0

# Second Fibonacci term is 1

elif n==1:

 return 1

else:

#find the nth term of Fibonacci sequence

 return nth_fib_term(n-1)+nth_fib_term(n-2)

n=int(input("please enter the term:"))

print(n,"th Fibonacci term is: ")

print(nth_fib_term(n))

Explanation;

Read the term "n" which user wants to know of Fibonacci sequence.If term term "n" is less than 0 then it will print "wrong input". Otherwise it will calculate nth  term of Fibonacci sequence recursively.After that function nth_fib_term(n) will return  the term. Print that term

Output:

please enter the term:7

7 th Fibonacci term is:

13

You might be interested in
What kind of software is Microsoft Outlook??
NNADVOKAT [17]

Answer:

Email software

Explanation:

8 0
3 years ago
Read 2 more answers
In the previous activity the learner developed an idea for a game, this included the game plot, storyline, characters, interacti
Neko [114]

Answer:

I hope this helps, this is my first time doing an answer in Brainly.

Explanation:

The game concept will be this, your character, being a green lizard, will jump from platform to platform. Constantly scrolling up with the character, but if you fall behind, it's game over.

If I know anything about smartphones is the the screens are usually tiny, and are very hard to play on. So I will impliment motion controls. If you tilt the screen in the direction you want the lizard to go, it will follow that tilt.

The pros is that it's a lot more easy when developing the game, the cons is that the games are usually super small.

3 0
3 years ago
Which of the following components controls the opening and closing of the valves in an engine?
leonid [27]
It seems that you have missed the given options for this question which are the following: 
<span>A. the crankshaft journals </span>
<span>B. the camshaft lobes </span>
<span>C. the rocker arms </span>
<span>D. the push rod 
But anyway, the correct answer would be option B. The camshaft lobes.
The component that controls the opening and the closing of the valves in an engine is the camshaft lobes. Hope this answer helps. </span>
7 0
3 years ago
True or false?
sashaice [31]
True cars are fast and go fast
6 0
3 years ago
Read 2 more answers
Edhesive 3.6 Lesson Practice
FinnZ [79.3K]
You have to put all of the lesson together do we need
3 0
3 years ago
Other questions:
  • Two VALS segments stand apart. One segment represents the group with the highest resources and innovation and the other segment
    9·1 answer
  • In 1948, a Bell Labs researcher named Claude Shannon wrote a technical report in which he proposed that all information media co
    11·1 answer
  • Write a C++ program using a do while loop for (Find the highest score). The program should work for any number of students. Run
    10·1 answer
  • Which statement best describes when Variable Substitution (expansion) can occur?
    6·2 answers
  • Write a program with a loop that lets the user enter a series of positive integers. The user should enter −1 to signal the end o
    7·1 answer
  • Can you tell me what to put in these line please!
    9·1 answer
  • 8.4 Lesson Practice <br> edhesive quiz
    12·1 answer
  • Which of these purchases is most likely to be paid for with a credit card
    13·1 answer
  • What is the computer that is connected to a<br> server
    8·2 answers
  • 4) What is a desktop?​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!