+ 1

How this code runs

Tell me 😃😃 ANURAG THANKS https://code.sololearn.com/cIl226Fgr5EJ/?ref=app

1st Apr 2021, 1:49 PM
Anurag Kumar
Anurag Kumar - avatar
3 Respostas
+ 5
See u must be knowing that random.randint returns a number between starting value and ending value (both included). Your code: import random Ar=[20,30,40,50,60,70] From=random.randint(1,3) To=random.randint(2,4) for K in range(From,To+1): print(Ar[K],end="#") So for From u can have possible values as 1 or 2 or 3. And for To u can have possible values as 2 or 3 or 4. And now for the range of K the staring value can be 1 or 2 or 3. And the stoping value can be (2+1) or (3+1) or (4+1). So in this code u can get different outputs as for Ar [K] u can have K from 1 to 4 . But u will never get 20 or 70 as output. Because for Ar [K] u will never get K as 0 or 5. I hope this will help you.
1st Apr 2021, 2:21 PM
Kǟrɨsɦmǟ ❥
Kǟrɨsɦmǟ ❥ - avatar
+ 2
You're welcome 🤗
1st Apr 2021, 5:37 PM
Kǟrɨsɦmǟ ❥
Kǟrɨsɦmǟ ❥ - avatar
+ 1
Thanks sister ✨Kårï§hmå✨ ✨✨✨✨✨✨✨
1st Apr 2021, 5:36 PM
Anurag Kumar
Anurag Kumar - avatar