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]
3 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]3 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
Which type of address defines a single network interface in a computer or other device?
White raven [17]
MAC address
......... ..
4 0
3 years ago
What is computer ? What is computer program? What is hard disk.
g100num [7]
A computer is a electronic that helps you access the internet/WiFi
4 0
4 years ago
Read 2 more answers
What is a wireless network that provides communication over a short distance that is intended for use with devices that are owne
andrew11 [14]

Answer: personal area network

Explanation:

it can connect personal devices to make network, the personal network are phone,laptop,printer and soon in order to communicate.

3 0
3 years ago
Read 2 more answers
The reason for prioritizing your work is to get the
7nadin3 [17]

Answer:

a

Explanation:

3 0
3 years ago
How to fix the Run Time ERROR 3706 provider cannot be found in ACCESS 2007?
stiks02 [169]
Hey,
Its a very rare error error in VB installation,
Try installing this:
<span>Jet 4.0 Service Pack 8 (SP8) for Windows XP (KB829558)
</span>I hope this will help.
7 0
3 years ago
Other questions:
  • In number theory, a perfect number is a positive integer that is equal to the sum of its proper positive divisors, that is, the
    12·1 answer
  • The CSS relative positioning property called ____ moves the element relative to its original position but preserves the space re
    9·1 answer
  • How can you keep your files organized on your computer?
    13·2 answers
  • Write the statements needed so that the variable secondWord is associated with the second word of the value of sentence . So, if
    13·1 answer
  • The hexadecimal number system uses alphabets A to F to represent values_ to _
    12·2 answers
  • PLEASE HELP QUICK WILL GIVE BRAINLY
    6·1 answer
  • Type 1 hypervisor:
    10·1 answer
  • Un producto tecnológico puede ser tangible o intangible?
    6·1 answer
  • Write a list comprehension that creates a list containing the numbers that result from the values 1 through 10 being multiplied
    15·1 answer
  • How many different four-letter combinations for a locker password can you make with the lowercase and uppercase forms of the fir
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!