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
Illusion [34]
2 years ago
8

Write a function that takes as input a single integer parameter n and computes the nth Fibonacci Sequence number. The Fibonacci

sequence first two terms are 1 and 1. (so, if n = 2, your function should return 1). From there, the previous two values are summed to come up with the next result in the sequence 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, etc.
Computers and Technology
1 answer:
RSB [31]2 years ago
4 0

Answer:

Following are the code to this question:

def Fibonacci(n):#defining a method Fibonacci that accept a parameter

   a = 1#defining a variable a that holds a value 1

   b = 1#defining a variable b that holds a value 1

   if n <= 0:# Use if to check n value

       print("invalid number")#print message

   elif n == 2:#defining elif that check n equal to 2

        return 1#return 1

   else:#defining else block

       print(a)#print value of a

       print(b)#print value of b

       for i in range(2,n):#defining for loop to calculate series

           s = a + b# add value in s variable

           a = b # interchange value

           b = s# hold s value

           print(s)#print s value

Fibonacci(10)#calling method

Output:

1

1

2

3

5

8

13

21

34

55

Explanation:

In the above-given program code, a method "Fibonacci" is defined, which holds a value "n" in its parameter, and inside the method two-variable "a and b" is defined, that holds a value "1".

  • In the next step, if a block is defined that checks n value is less than equal to 0, it will print "invalid number" as a message.
  • In the elif, it checks n value is equal to 2 it will return a value that is 1.
  • In the else block, it will calculate the Fibonacci series and print its value.
You might be interested in
27. List four advantages of Computer Aided Design over traditional hand
tatyana61 [14]

Decrease in error CAD software makes use of some of the best tools, the percentage of error that occurred because of manual designing is significantly reduced.

Decrease in effort when it comes to the amount of effort that was needed for the sake of designing the different models, it has been reduced significantly because the software automates most of the task.

Saves time when you are using the computer aided design software, it will save your time and you can make better and more efficient designs in shorter time duration.

Easy to edit when you are making designs, you may find the need to make alterations. When you are using computer aided design software, it will be much easier to make any changes because you can fix the errors and modify the drawings easily.

8 0
3 years ago
Using the notation exemplified in following question , list a set of tables and attributes (and identify keys) to represent the
Paha777 [63]

Answer:

Entities are - Students, CourseList, Advisor and CourseSelection.

Explanation:

The database is structure is designed using Crow Foot Database Notation as attached

6 0
3 years ago
What web 2.0 features allows users to subscribe to a data plan that charges for the amount of time spent on the internet?
galina1969 [7]

Answer:

The answer to this question is given in the explanation section. The correct option is long tail

Explanation:

a.Folksonomy

Folksonomy is a way of organizing data and digital content. With Web 2.0, users can collaboratively manage and tag photos, journals and other media. As more users do this, creates a system of classification for the media and information.  so this option is not correct

b. long tail (correct option)

Some sites are able to offer services as well in which users can subscribe monthly or pay a fee every so often. An example of this would be Netflix.

c.user participation

All users have the free will to contribute to the site which makes many Web 2.0 pages public. With sites such as Wikipedia, anyone is open to the editing of articles. Information is provided two-way instead of solely from the site owner.

d.application

Web 2.0 applications that allow anyone to create and share online information or material they have created. As you know that there are number of different types of web 2.0 applications including wikis, blogs, social networking, folksonomies, podcasting & content hosting services.

3 0
3 years ago
What is the name of a computer or application program that intercepts user requests from the internal secure network and then pr
defon
A proxy server is a server that intercepts user requests from the internal secure network and then processes that request on behalf of the user.
The proxy server can be a computer or application program<span> that gets the requests from clients and seeks resources from other </span>servers. It is a <span>intermediary point between the end user and the backbone network.</span>
8 0
3 years ago
Which sentence uses parallel structure correctly?
Archy [21]

Answer: Correct option is Option D.

Explanation:

Processed foods are bad for you, are high in fat, and are the cause of serious health issues.

Parallel structures are those structures where words are used in same pattern in a sentence to show that two given ideas/phrases are of similar significance.

This sentence uses parallel structure correctly.

Parallel structure in the sentence are -

are bad for you

are high in fat

are the cause of serious health issues

3 0
2 years ago
Other questions:
  • Your company is developing a new marketing campaign and wants to know which customers have never placed an order. You will need
    10·1 answer
  • Semiconductor memory is used mainly for primary storage even with its high cost. In another hand, the magnetic tape is the cheap
    6·1 answer
  • Generate the requested sets using only set builder notation and the provided sets. Some problems may require you to build one or
    15·1 answer
  • How many arguments are required for the sum function?
    15·1 answer
  • Two technicians are discussing shielded cable. Technician A says that shielded wires are generally twisted in pairs to cancel th
    14·1 answer
  • Describe two circumstances where access services might get implemented by organizations please.​
    9·1 answer
  • he degree of operating leverage is equal to: Group of answer choices FC / OCF. VC / OCF. 1 FC / OCF. 1 VC / OCF. 1 Picture FC /
    9·1 answer
  • Join each of the follwing sentences using unless
    14·2 answers
  • What is the main function of processing unit​
    5·2 answers
  • Evaluate a career in the telecommunications industry that most interests you. What about the career appeals to you?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!