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
You should always be afraid to use the internet<br><br> True or false?
ch4aika [34]

Answer:

false

Explanation:

you should be but in the same time no

7 0
3 years ago
Application Software include programs like: MS Word, Google Docs, MS Exce ect...
ycow [4]

Answer: True A.

Explanation: Every app has or needs a program

By demmaku :v

7 0
3 years ago
When analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. This adjustm
Ksivusya [100]

Answer:

5.23 LAB: Adjust values in a list by normalizing When analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. This can be done by normalizing to values between 0 and 1, or throwing away outliers.

Explanation:

7 0
3 years ago
What would be a good hash code for a vehicle identification that is a string of numbers and letters of the form “9x9xx99x9xx9999
Hunter-Best [27]
I also want to ask a question recently i used a software named [url=http://www.videoconverterfactory.com/tips/youtube-to-flac.html]youtube to flac[/url] while after the conversion the size is to big. Why did this happen and how to solve without lose quality?
4 0
3 years ago
Which of the following are the dimensions of feasibility? Group of answer choices cost, schedule, technical, and organizational
Paha777 [63]

Answer:

"cost, schedule, technical, and organizational feasibility schedule" is the correct option.

Explanation:

A technical feasibility is the study of the concerned about the specifying software and tools which satisfy the users' need. It is also the process of thinking for which business technologies are important to bring labours, transportation, and materials.

An organizational feasibility is the study of the information of the professional background and about the skills which are necessary for the contribution in the business.

7 0
3 years ago
Other questions:
  • How is the Task Manager helpful in displaying which resources your computer is using and how fast?
    5·2 answers
  • The Active Directory Users and Computers tool can be used to:______.
    11·1 answer
  • Do you like PC? Why? (I need your opinion for research)
    10·2 answers
  • Role-playing, action, educational, and simulations are examples of computer and video game _____. Windows and Apple offer_____ ,
    13·1 answer
  • For a line segment, show that clipping against the top of the clipping rectangle can be done independently of the clipping again
    7·1 answer
  • For any two documents x and z, define k(x, z) to equal the number of unique words that occur in both x and z (i.e., the size of
    15·1 answer
  • What does the internet engineering task force (IEFT) do?
    5·1 answer
  • / Looks up author of selected books
    15·1 answer
  • If you had tickets for the concert and saw these alerts, what should you do?
    12·1 answer
  • Which of the examples is part client side code
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!