+ 1
How this code runs
Tell me 😃😃 ANURAG THANKS https://code.sololearn.com/cIl226Fgr5EJ/?ref=app
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.
+ 2
You're welcome 🤗
+ 1
Thanks sister ✨Kårï§hmå✨ ✨✨✨✨✨✨✨