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
The order of precedence determine
Free_Kalibri [48]
The order of precedence is the hierarchical order in which calculations are conducted. The simplest example of this is the way you always multiply before you add numbers.
7 0
4 years ago
How to implement switch statement in Python?
Jet001 [13]

Answer:

Switch-case statements are a powerful tool for control in programming. In this article, Sreeram Sceenivasan goes over you can use a switch-case statement in Python.

Explanation:

Python doesn’t need a switch statement. You can do exactly the same thing with if/elif/else statements.

5 0
3 years ago
Read 2 more answers
Identify a stressor in your life. Conduct an internet search to locate at least two reliable sources of information on effective
Gre4nikov [31]

Answer:

The biggest stressor in my life is certainly accountancy. I need to divide my earning among my family members, however, I had to work as well. and hence, I wanted to cover this automatically. I decided to surf the internet. I realized I need to first find the keyword. And I found it as budgeting and the monthly income. I got all my answers. The source explained to be how I can transfer a part of my income to each of my family members, and also to grocery sites like Amazon, the daily service provider who provide various home servants, for electricity bills, yearly water tax, house tax, and all my expenses. And now I can relax and work, as with one click, I can now pay all my bills, as well as I can order for instant food deliveries, call plumbers, electricians, etc any time and everything I can think of. I have no headache now, and I can devote all of my hours to work. And that has also increased my income since I went automatic.

Explanation:

Thus, we need to first find the keyword, and then find the best site from the list that appears. And then we need to research through that site and find the solution.We can make use of the search engine commands as well.

4 0
4 years ago
Write down the functions of network layer in your own words.ASAP pleaseeeeeee
Dima020 [189]

Answer:

The network layer is the layer is the layer 3 of the seven layer Open System Interconnect (OSI model) which functions as packet forwarder for the  intermediate routers  by implementing technologies used for switching that provides virtual circuits' logical path

The function of the network layer includes;

1) Routing and forwarding of packets to destination which enables connectionless communication

2) Enabling internetworking

3) Hierarchical host (IP) addressing

4) Sequencing of packets

5) Handling of errors

6) Control of network congestion to prevent the collapse of the network

Explanation:

7 0
3 years ago
Which memory device is most appropriate for backing up a computer’s hard drive?
Luba_88 [7]
It depends on how much storage. I usually connect mine to another hard drive.
4 0
4 years ago
Other questions:
  • To create an identical version of a slide you would click
    6·2 answers
  • What is micro blogging?
    13·1 answer
  • For security reasons a network administrator needs to ensure that local computers cannot ping each other. which settings can acc
    5·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    12·1 answer
  • Consider the following process for generating binaries. A compiler is used to generate the object code for individual modules, a
    8·1 answer
  • Task1: #Define a function called show_students which takes 2 parameters students and message #Print out a message, and then the
    14·1 answer
  • Write a qbasic program to supply first , middle and last name of a person and print the output as given below :
    9·1 answer
  • Alguien que me pueda ayudar diciéndome las características de Visual Object en programacion porfavor?!
    6·1 answer
  • A _________ attack is an attack on a computer system or network that causes a loss of service to users.
    15·1 answer
  • Sidney needs to create a decimal number variable that will be added to another number. What kind of variable is required?binaryB
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!