0

Why not write all the numbers from the list ..? (recursive)

"Runs and write the list with a recursive function" The function first writes 1 and then 0 from the list from random import randint def runsList(A): if (len(A) <= 1): return if A[0] == 1: print (A[0]," ",end="") runsList(A[1:]) if A[0] == 0: print (A[0]," ",end="") A = [randint(0,1) for i in range(10)] print (A) recorreList(A) https://code.sololearn.com/c558nT5JlRz0

22nd Mar 2017, 2:12 AM
Javier I. Rivera R.
Javier I. Rivera R. - avatar
1 Respuesta
0
try if len(A) < 1:
22nd Mar 2017, 7:28 AM
Ruslan Ovcharenko
Ruslan Ovcharenko - avatar