0
Can anyone explain this nested loop?
n=3 for i in range(1,n+1): for j in range(1,i): print("#",end=" ") print( )
6 Antworten
+ 3
Change "#" to j and set n to 4 or 5. Also put the last print in the outer loop. Then you can understand it from the output I guess.
n=5
for i in range(1, n+1):
for j in range(1, i):
print(j, end=" ")
print()
0
Thank u benjamin
I want the output of the program to be like this
* *
* *
* *
How to code the program thru nested for loop to get the above output?
0
Thanks Kiboo
What will happen if i go with i instead of n in inner for loop
n=3
for i in range(1,n+1):
for j in range(1,i):
print("#",end=" ")
print( )
0
Mr.kiboo can u explain how nested loop works?
Please