Nested loop | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

Nested loop

I do not uderstand output of this code i,j=0,0 for i in range(0,5): print() for j in range(0,i+1): print(j , i) for y in range(0,j+1): print(i,j,y) for x in range(0,y+1): print(i,j,y,x)

22nd Jul 2022, 10:42 PM
mohamed essa
mohamed essa - avatar
1 Respuesta
0
1. i dont think u must define variable i and j if uh are gonna use it in loop. 2.as far as i know print() will print blank and sends the cursor to second line 3. the more times loops run the values of variables i,j,y,x also increases. 4.it will start printing the values. 5. Where did uh got this question? >_<
25th Jul 2022, 2:27 PM
Sudip Shrestha
Sudip Shrestha - avatar