QuesAns Print Page – CSKC
Sign In

Search

siteicon
Q&A CBSE12A-2016-B01F #6280

Question:

What are the possible outcome(s) executed from the following code? Also specify the maximum and minimum values that can be assigned to variable PICKER.

import random
PICKER=random.randint(0,3)
COLOR=["BLUE","PINK","GREEN","RED"];
for I in COLOR:
    for J in range(1,PICKER):
        print(I,end="")
    print()
(i) (ii) (iii) (iv)
BLUE
PINK
GREEN
RED
BLUE
BLUEPINK
BLUEPINKGREEN
BLUEPINKGREENRED
PINK
PINKGREEN
GREENRED
BLUEBLUE
PINKPINK
GREENGREEN
REDRED

Answer:

Option (i) and (iv) are possible
OR
Option (i) only
PICKER maxval=3 minval=0