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 does coding robots fit into STEAM
expeople1 [14]
Coding robots fits into the technology part of STEM.
5 0
4 years ago
Please help on both of these questions will give brainliest<br> !!
Alja [10]

I think the first one is All of the above

3 0
3 years ago
Read 2 more answers
What is an XML-based open standard for exchanging authentication and authorization information and is commonly used for web appl
nalin [4]

Answer:

SAML.

Explanation:

SAML seems to be an accessible standardized XML-based for some of the sharing of validation and verification details and has been generally implemented for the web apps and it seems to be a design that would be SSO. Verification data is shared via XML documentation which are securely signed. So, the following answer is correct according to the given scenario.

4 0
3 years ago
The system where the unit of measurement is centimeter
aleksklad [387]

Answer:

International System of Units

Explanation:

3 0
3 years ago
Microsoft created Adobe Photoshop? TRUE FALSE​
kari74 [83]

Answer:

false the creator of adobe photoshop was microsoft adobe photoshop is a popular photo editing software which was developed by a company named as adobe inc.

5 0
3 years ago
Read 2 more answers
Other questions:
  • The BIOS feature that enables a hard drive to read or write several sectors at a time is called what?
    5·1 answer
  • What is a organisation in office technology
    7·1 answer
  • Can you help please.
    11·1 answer
  • When a structure satisfies all the properties of a relation except for the first item—in other words, some entries contain repea
    7·1 answer
  • Which of the instances below is an example of a Trojan horse? Question 2 options: a) An attachment in an email that is really a
    8·2 answers
  • Which label belongs in the area marked Z? Producers Science Question
    7·2 answers
  • Design and implement a program (name it Youth) that reads from the user an integer values repressing age (say, age). The program
    6·1 answer
  • . An exception is an error that occurs during the execution of a program at run-time that disrupts the normal fow of the Java pr
    5·1 answer
  • Question 14. 14. PowerPoint assumes every new slide, except for a blank slide, has _____.
    13·1 answer
  • g write a recursive function that prints out all the even numbers between x and y inclusive if x is odd then the print out will
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!