+ 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(' ')

6th Aug 2018, 4:26 PM
Praveen Neevarp
Praveen Neevarp - avatar
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
7th Aug 2018, 4:33 AM
Markus Kaleton
Markus Kaleton - avatar
+ 8
please take a pencil and a piece of paper and do it step by step. it will give you a good insight.
6th Aug 2018, 4:32 PM
Oma Falk
Oma Falk - avatar