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 –
Minimum value=5
Maximum value=8
So the only possible values are O, G, R, A
Only option (iii) is possible.