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
Thanks for help evreybody
ladessa [460]

Answer:

np

Explanation:

7 0
3 years ago
Read 2 more answers
What specific database stores local user accounts on local computers, and allows users to sign in to and access resources only o
Yuki888 [10]

Answer:

The Security Account Manager

Explanation:

The Security Account Manager (SAM), This is a database file found in Windows Operating Systems.... Windows XP, Windows Vista, Windows 7, 8.1 and 10 that stores users' passwords. It can be used to authenticate local and remote users. It is  an important and vital component of how Windows stores passwords locally on the computer.

5 0
3 years ago
A computer user who purchases a software package that will not operate on his or her hardware configuration is a victim of which
Natalija [7]
Is this a math problem? I don't get what you are trying to say sorry
5 0
2 years ago
Which one can be used as watermark in a word document?​
otez555 [7]

Answer:

On the Design tab, select Watermark.

In the Insert Watermark dialog, select Text and either type your own watermark text or select one, like DRAFT, from the list. Then, customize the watermark by setting the font, layout, size, colors, and orientation. ...

Select OK.

4 0
3 years ago
We will find an video named????<br> Help us and select once name. <br> Complete: B__in___t
liberstina [14]
Beint cause its cool yea yea
7 0
3 years ago
Read 2 more answers
Other questions:
  • _____ is a web application server that provides the ability to connect web servers to multiple data sources.
    9·1 answer
  • Consider the following implementation of a class Square:
    12·1 answer
  • How to write a function that counts the letters in a string in C?
    13·1 answer
  • Which command button contains the following sub options as given in the picture?
    6·2 answers
  • Write a program that extracts the last three items in the list sports and assigns it to the variable last. Make sure to write yo
    8·1 answer
  • You are asked to provide a list of security groups a user is a member of. You write a script to pull the data from Active Direct
    11·1 answer
  • How are the number of rows calculated.​
    14·1 answer
  • 100POINTS!!!!!!!!!!!!!!!!!!!I WILL ANSWER ALL OF YOUR QUESTIONS PLEASE LOVES:)))Upload your completed project including the foll
    12·1 answer
  • How do you customize calendar view​
    9·2 answers
  • Please choose odd one out please tell fast​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!