skyrimmaster429 skyrimmaster429
  • 08-07-2020
  • Computers and Technology
contestada

What is the output of the following Python statements? def recurse(a): if (a == 0): print(a) else: recurse(a) recurse(0)

Respuesta :

Keiryy492
Keiryy492 Keiryy492
  • 09-07-2020

Answer:

d) 0 1 1 2

The above piece of code prints the Fibonacci series.

Explanation:

def a(n):

   if n == 0:

       return 0

   elif n == 1:

       return 1

   else:

       return a(n-1)+a(n-2)

for i in range(0,4):

   print(a(i),end=" ")

Answer Link

Otras preguntas

What was the result of the Battle of Fort Duquesne in 1755 that sparked the French and Indian War?
the area of a square is given by the expression x^2-12x+36 square inches. find an expression that represents the length of one side of the square in inches
If 0=6n-36 find the value of n-5.
Energy in an ecosystem flow from consumers to producers. True or False
What type of macromolecule is an enzyme
What is the lowest number 588 can be multiplied by so that the result is a squared number?
What does the area under the curve on a velocity versus time graph represents
Which business practice did Rockefeller repeatedly use that helped him succeed in building his oil monopoly?
What multiplies to give you 130 and adds or subtracts to give you 3?
write 6, 362, 049 in both expanded and word forms