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
spayn [35]
3 years ago
6

The first and second numbers in the Fibonacci sequence are both 1. After that, each subsequent number is the sum of the two prec

eding numbers. The first several numbers in the sequence are: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, etc. Write a function named fib that takes a positive integer parameter and returns the number at that position of the Fibonacci sequence. For example fib(1)
Computers and Technology
1 answer:
vlabodo [156]3 years ago
7 0

Answer:

In Python:

def fib(nterms):

   n1, n2 = 1, 1

   count = 0

   while count < nterms:

       term = n1

       nth = n1 + n2

       n1 = n2

       n2 = nth

       count += 1

   return term

Explanation:

This line defines the function

def fib(nterms):

This line initializes the first and second terms to 1

   n1, n2 = 1, 1

This line initializes the Fibonacci count to 0

   count = 0

The following while loops gets the number at the position of nterms

<em>   while count < nterms: </em>

<em>        term = n1 </em>

<em>        nth = n1 + n2 </em>

<em>        n1 = n2 </em>

<em>        n2 = nth </em>

<em>        count += 1 </em>

This returns the Fibonnaci term

   return term

You might be interested in
How are some businesses capitalizing on social media at the time of someones death
stiv31 [10]
They'll post condolences messages etc which means many people will discover their business if they are looking for posts mentioning the deceased's name on social media. 
7 0
3 years ago
Which platforms they thinks is better to use for sharing their content,ideas,and stories?
aliina [53]
I personally believe a blogging site is better to use to share content, ideas, and stories because the main point of a blogging site is to show your ideas with other people but I also believe social networking site is good too because there’s a lot of people who use social media to share and show what they believe.
Hope this helps
5 0
3 years ago
What is it called when the system and all the components except for the real-time clock are powered down
Colt1911 [192]

Answer:

The correct answer to the following question will be "Mechanical off mode".

Explanation:

  • The device will appear to be either on or off to the user. No other states are measurable. The device does, however, support various power states that suit the power states specified in the ACPI specification. Such states also differ, like hybrid sleep and rapid startup. This subject discusses certain states and how they will be represented.
  • The system is completely off, and no power is used. Only after a full reboot will the machine return to working condition.
  • It is called mechanical off mode when the machine and all parts, except for the actual-time clock, are down powered.

Therefore, Mechanical off mode is the right answer.

8 0
3 years ago
When you examine a computer chip under a microscope, what will you see?
ELEN [110]
<span>When you examine a computer chip under a microscope,  you will see </span>integrated circuits.
5 0
3 years ago
Secondary storage is also called?
Alekssandra [29.7K]

it is also called external storage

4 0
3 years ago
Other questions:
  • After you enter the details for the first selected recipient in the New Address List dialog box, click _______ to add another re
    11·2 answers
  • There are several different types of RAM, each with its own purpose. Name the three types of RAM and briefly describe their func
    8·2 answers
  • In Microsoft Word, how would you change the amount of space that is put in after each paragraph?
    15·1 answer
  • What is an activity that can help you enhance the appearance of your computer’s desktop?
    13·1 answer
  • cellPhoneBill(m,tx)Write the function cellPhoneBill()that takes two int m and txas input and returns a float.The function takes
    11·1 answer
  • What was the basic invention that has evolved into the modern automobile?
    13·1 answer
  • When you write contracts, should you list many definitions at the start of the document?
    6·1 answer
  • When entering numbers that start with a zero, apply the _____ number format.
    12·1 answer
  • You are an IT technician for your company. One of your employees has a computer that continually reboots when it is powered on.
    8·1 answer
  • What is the result of the following code?<br><br> x=7//2+10%2**4<br><br> print(x)
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!