+ 1
Can you explain this? I can't understand this!!! Please
for i in range(10): for a in range(10): if a<=i: print('*', end=' ') else: print(' ', end=' ') print(' ')
2 Answers
+ 2
the inner for loop will run ten times for every i in the first for loop.
and if the inner a is smaller or equal to i it will make a star.
since the i will rise every 10 a:s you will get one more star every 10 a:s
draw every loop on this and make notes or something if you are having hard time understanding it
+ 8
please take a pencil and a piece of paper and do it step by step.
it will give you a good insight.