Computer Science, asked by shaillygupta1034, 10 months ago

What possible outputs(s) are expected to be displayed on screen at the time of execution of the program from the following code? Also specify the maximum values that can be assigned to each of the variables FROM and TO. 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="#") (i) 10#40#70# (ii) 30#40#50# (iii) 50#60#70# (iv) 40#50#70#

Answers

Answered by Swetha03K
164

Answer:

(ii) 30#40#50#

Explanation:

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="#")

Let's analyze it one by one.

First, let FROM be 1 and TO be 2.

now, it becomes:

for K in range(1,2+1):

which is (1,3):

So, trying the last line:

print(AR[K],end="#")

K is now 1, so AR[1] is 30.

Let's see the (ii)nd option.

30#40#50

As 30 appears at the start itself and its d only option, u can directly write the ans. as (ii)

or u may check it, it would fetch u d same result.

Sorry if i confused u (:

Answered by Debasish98
25

Answer:30#40#50# max value from tois(3,4)

Explanation:

Similar questions