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
sp2606 [1]
3 years ago
13

A python script to print fibonacci series first 20 elements

Computers and Technology
1 answer:
madreJ [45]3 years ago
5 0

Answer:

   nterms =20

   # first two terms

   n1, n2 = 0, 1

   count = 0

   # check if the number of terms is valid

   if nterms <= 0:

      print("Please enter a positive integer")

   elif nterms == 1:

      print("Fibonacci sequence upto",nterms,":")

      print(n1)

   else:

      print("Fibonacci sequence:")

      while count < nterms:

          print(n1)

          nth = n1 + n2

          # update values

          n1 = n2

          n2 = nth

          count += 1

Explanation:

Here, we store the number of terms in nterms. We initialize the first term to 0 and the second term to 1.

If the number of terms is more than 2, we use a while loop to find the next term in the sequence by adding the preceding two terms. We then interchange the variables (update it) and continue on with the process.

<em>output:</em>

Fibonacci sequence:

0

1

1

2

3

5

8

You might be interested in
Access-lists pose a logical problem which often has more than one solution. Can you think of a different set of rules or placeme
NARA [144]

Answer:

Question is incomplete. it needs a topology diagram and also it needs Router R1 table. I assume User has access to the topology and Routing table.

Below Configuration will help to fix ACL problem

Hosts from the 172.16.0.0/16 network should have full access to Server1, Server2 and Server3 but this is not currently the case, as L1 can’t communicate to Server2 or Server3.

Explanation:

Following Configuration on Cisco Router R1 will help to fix all the ACL problems.

enable

configure terminal

no ip access-list standard FROM_10

ip access-list standard FROM_10

deny host 10.0.0.2

permit any

exit

!

no ip access-list standard FROM_172

ip access-list standard FROM_172

permit host 172.16.0.2

exit

!

interface GigabitEthernet0/0

ip access-group FROM_192 out

end

write memory

!

6 0
3 years ago
True or false: The objective of an Enterprise Resource Planning (ERP) system is to create a customized software program that int
UkoKoshka [18]

Answer:

True

Explanation:

3 0
3 years ago
URGENT!!! Which statement is true with regard to bitmap images?
liberstina [14]

Answer:

<u><em>D. You can modify colors easily and quickly.</em></u>

Explanation:

8 0
3 years ago
Read 2 more answers
Which of the following is involved in creating technical communication?
Eva8 [605]

Answer:

(D) All of these answers are correct.

Explanation:

Technical communication is the transmission of any specialized information, be it scientific reports, medical procedures, and any other professional information. Technical information are passed for a specific a purpose are factual, precise, concise and clear. An electrical engineer filling out a standardized form, a webmaster revising a company web page, a company secretary writing a letter to a customer and a manager preparing an oral presentation are all conveying technical information.

8 0
3 years ago
Who invent cars and who invent bikes and who invent pc
julia-pushkina [17]

Answer:

  • Cars were invented in 1886 by Karl Benz.
  • The term bicycle was coined in France in the 1860s, but The first verifiable claim for a practically used bicycle belongs to German Baron Karl von Drais in 1817
  • The first computer was by Charles Babbage, an English mechanical engineer and polymath he originated the concept of a programmable computer.

7 0
3 years ago
Other questions:
  • Why do computers need to periodically check the dns for websites you have already visited? enter your answer here?
    15·1 answer
  • A(n) ____ attack is when a system is compromised and used to attack other systems. a. indirect b. direct c. object d. subject
    13·1 answer
  • Write a main function to do the following: A. Declare an array of 20 strings. B. Create an input file for the file "poem.dat". C
    12·1 answer
  • By default, power search will
    14·1 answer
  • A(n) _________ is a formal access control methodology used to assign a level of confidentiality to an information asset and thus
    6·1 answer
  • A series of four or five comparisons and calculations that together determine an employee's withholding tax value might be group
    6·1 answer
  • Problem: you need to write a code that read 2 array of size 10x10 of zero and ones that represent black
    8·1 answer
  • Which of the following binary numbers is equivalent to decimal 4?
    8·2 answers
  • Can some one help me answer this question plz
    8·1 answer
  • State the advantages of MS Excel in data encoding
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!