0
Nested loop
n=int(input("enter the number of rows:")) for i in range (1,n+1): for j in range (1,n+1): print(i, end='' ") print() Output: enter the number of rows:3 1 1 1 2 2 2 3 3 3 Please anybody explain me the body part , how this output came?
1 ответ
+ 1
Well it's easy i is printing j numbers of times. mean when i is 1 then j is printing 3 times i means three times 1 and after that i became 2 and j has printed 3 times i means 3 times 2 and so on....