+2 votes
in Class 12 by kratos

What are the possible outcome(*) expected from the following python code? Also specify maximum and minimum value, which we can have.

def main():

p = ‘MY PROGRAM’

i = 0

while p[i] != ‘R’:

l = random.randint(0,3) + 5

print p[l],’-’,

i += 1

(i) R – P – O – R –

(ii) P – O – R – Y –

(iii) O -R – A – G –

(iv) A- G – R – M –

1 Answer

+3 votes
by kratos
 
Best answer

Minimum value=5

Maximum value=8

So the only possible values are O, G, R, A

Only option (iii) is possible.

...