0

Help me why for i in range(0,4): for j in range(0,i):    print(i, j) Have output 10,20,21,30,31,30 ?

28th Oct 2020, 1:13 PM
Fariz Ghina
Fariz Ghina - avatar
4 Réponses
+ 2
i = 0, for j in range(0,0): Nothing i = 1, for j in range(0,1): print i and j once (1,0) i = 2, ... range(0,2): print i and j twice (2,0) (2,1) i = 3, ... range(0,3): print i and j three times (3,0) (3,1) (3,2)
28th Oct 2020, 1:18 PM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 1
Thats mean when i=3 or whatever it is, when print j is following i, right?
28th Oct 2020, 1:41 PM
Fariz Ghina
Fariz Ghina - avatar
+ 1
Amanbek Orynbay Correct! It prints the integer j where 0 ≤ j < i
28th Oct 2020, 1:51 PM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 1
Okay, thank you so much
28th Oct 2020, 1:56 PM
Fariz Ghina
Fariz Ghina - avatar