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
Novosadov [1.4K]
2 years ago
13

We will pass in a value N. Write a program that outputs the complete Fibonacci sequence for N iterations. Important: If N is 0,

then we expect to get an output of 0. If N=1 then we expect 0, 1 etc.
Computers and Technology
1 answer:
jasenka [17]2 years ago
3 0

Answer:

The program written in Python is as follows

def fibonac(N):

    series = ""

    for i in range(0,N+1):

         series = series + str(i) + ","

   return series[:-1]

N = int(input("Number: "))

print(fibonac(N))

Explanation:

This line defines the function fibonac

def fibonac(N):

This line initializes variable "series" to an empty string

    series = ""

This line iterates through the passed argument, N

    for i in range(0,N+1):

This line determines the Fibonacci sequence

         series = series + str(i) + ","

Lastly, this line returns the Fibonacci sequence

   return series[:-1]

The main starts here

The firs line prompts user for input

N = int(input("Number: "))

This line prints the Fibonacci sequence

print(fibonac(N))

You might be interested in
What is the top folder of the file tree called
m_a_m_a [10]
The root directory, or root folder, is the top-level directory of a file system.
3 0
3 years ago
Read 2 more answers
Why is it that even though there aren't the max number of answers on a question, (or sometimes even NO answers) When I click the
maks197457 [2]
It has happened to me before. i think it’s just because someone is already typing an answer maybe ‍♀️ or try restarting the app and get back on it. might be jus a glitch from the app but either way hope you get it fixed :)
4 0
2 years ago
The process of arranging the item of a column in some sequence or order is known as?
MatroZZZ [7]

answer: sorting??  

(hope it helps)

6 0
2 years ago
A​ _______ helps us understand the nature of the distribution of a data set.
Sphinxa [80]

Frequency distribution
3 0
2 years ago
What is a constructor? Why would you include a constructor in a class?
QveST [7]

Answer:

Constructor in the class is the member function that gets into action when any new object gets created in the class ,it gets invoked. It does not have any return type and no void return.

The constructor is used in the class because there is the requirement for the initializing of the new object and then only object can do the functioning in the program.

4 0
3 years ago
Other questions:
  • Which osi layer is responsible for combining bits into bytes and bytes into frames?
    8·1 answer
  • vulnerability is a feebleness which allows an attacker to condense a system's information assurance to security,is it true or fa
    14·1 answer
  • How I to turn this ''loop while'' in ''loop for''? var i = 0; while (i < 20) { var lineY = 20 + (i * 20); line(0, lineY, 400,
    11·1 answer
  • Which of the following is not a key way that a LAN shares
    15·1 answer
  • Discuss the difference between a broad internet search and a narrow internet search?
    12·2 answers
  • Moore's Law postulates that:This task contains the radio buttons and checkboxes for options. The shortcut keys to perform this t
    6·1 answer
  • Develop a program that will maintain an ordered linked list of positive whole numbers. Your program will provide for the followi
    13·1 answer
  • Please help with this coding question
    8·2 answers
  • You are designing an exciting new adventure game and you want to attempt to explain where items that are carried by the player a
    6·1 answer
  • Uh can somebody help me
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!