0

Can anyone explain me how this code works

https://code.sololearn.com/cv171P9PSo6F/?ref=app

18th Oct 2020, 1:15 PM
zeeshan
zeeshan - avatar
2 Answers
+ 1
Just output tells you. In that iterable range() Fisrt index is start index, next is end index ( not inclusive), 3rd one is step count. range(start, end, step_count) Ex: for outer in range(5,10,4): For outer values are 5, in next iteration 5+4=9 In next 9+4=13 but it is exceeds end value 10 so it is not taken and loop exits.. Edit : revise this for more clarity : https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2434/
18th Oct 2020, 1:26 PM
Jayakrishna 🇼🇳
0
Outer loop loops over the following range=>5,9 So during first iteration , Inner loop loops over the following range=>1,3 with outer being assigned 5 and prints 5,1 5,3 During second iteration inner loop loops over the following range =>1,3,5,7 with outer being assigned 9 and prints 9,1 9,3 9,5 9,7 I highly recommend you to go through python course again if you cudn't understand at all how this worked
18th Oct 2020, 1:21 PM
Abhay
Abhay - avatar