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

Which option contains a true statement about cell theory? O Louis Pasteur did an experiment that proved new cells come from the rotting remains of organisms. Th
Which options identify a key point of cell theory? (Select all that apply.) Cells carry out functions that maintain life. Living things are nde of one or more c
Given: BD ⊥ BC; ABD ≅ DBE Prove: ABD and EBC are complementary
Seeking help with answers and solutions for this. please help
Post responses to both prompts. You must post on two different days to earn full credit for participation. Post 1: You learned the definition of the American Dr
A biased dice is rolled and the results are recorded in a table. The dice is rolled once more. a) Use the table to estimate the probability that a 3 will be rol
Globalization has created more choice in the market and therefore more variety in supply and demand, and has created transportation jobs. However, as technologi
I'm bo.red, your bor.ed, were all bor.ed.
£12000 borrowed for 17 months at a rate of 12.5% p.a.
How many molecules are contained in a 4.30-g sample of dimethylmercury?