0% found this document useful (0 votes)
6 views6 pages

Random Function Outputs For Practice

Output
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
6 views6 pages

Random Function Outputs For Practice

Output
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 6
261. Consider the following code : import random print (100 + random. print (100 + random print (100 + random srandint(5, 10), en print (10 + random. [Textbook Q. 9, Chapter 4 (Type B)] randint(5, 10), end="' ) randint(5, 10), en -randint(5, 10)) * Find the suggested output options (i) to (iv). Also, write the least value and highest value that can be generated. (i) 102 105 104 105 (iii) 105 107 105 110 (ii) 110 103 104 105 (iv) 110 105 105 110 possible outcome(s) executed from the following code ? A nd minimum values that can be assigned to variable PICKER. it [Textbook Q. 11, Chapter 4 ( ty import random ae PICK = random.randint(@, 3) 'MUMBAL", “CHENNAI”, "KOLKATA" ] 5 for Tin CITY : Bs for J in range(1, PICK) : print(I, end="") print() DELHIDELHT (i) DELHT MUMBAIMUMBAL DELHIMUMBAT CHENNATCHENNAT DELHIMUMBALCHENNAL KOLKATAKOLKATA DELHI (io) DELHT MUMBAT MUMBAIMUMBAT CHENNAT KOLKATAKOLKATAKOLKATA KOLKATA Ossible output(s) are expected to be displayed on screen at the time of m from the following code ? Also specify the maximum values that can be ‘variables FROM and TO. [CBSE Sample Paper import random AR = (20,38, 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 = "#") (ii) 308402502 (iv) 402508708 ble outputs(s) are expected to be displayed on screen at the time of ‘of the program from the following code ? Also specify the maximum at can be assigned to each of the variables FROM and TO. a ort random [20,30,40,50,60,70]; =random.randint(1,3) ‘TO=random.randint (2,4) or K in range(FROM,T0+1) print (AR[K],end = "#") (ii) 30#40#50# (iv) 40#50#70# the following code : math port random (str( int( math. pow( random.randint(2, 4), 2))), end (str( int( math. pow( random.randint(2, 4), 2))), end (str( int( math.pow( random.randint (2, 4), 2)))) ld be the possible outputs out of the given four choices ? (i944 (iii) 16 16 16 9 (494 (i444 e following code : random rt(int( 28+ random.random() *5), end=' ' ) int( 20 +random.random() *5), end='' ) -random() *5), end='' ) “int (int( 20 + random.random() *5)) d the suggested output options (i) to (iv). Also, write the least value anc est value that can be generated. 20 22 24 25 (ii) 22 23 24 25 23.24 23 24 (iv) 21 21 21 21

You might also like