0
What possible outputs are expected to be displayed on the screen at the time of execution of theprogram from the following code?
What possible outputs are expected to be displayed on the screen at the time of execution of theprogram from the following code? Also specify the minimum and maximum values that can be assigned to the variable c. import random temp=[10,20,30,40,50,60] c=random.randint(0,4) for I in range(0, c): print(temp[i],â:â,end=â#â) (i) #10#20 (ii) 10#20#30#40#50# (iii). 10#20#30# (iv) 50#60#
1 Answer
+ 1
Assuming that the errors are fixed, (indentation, incorrect quotes)
randint(a, b) is inclusive from a to b.
0-4 in your case.
range() however is not.
This means the max range returned would be 0-3.
This leaves (i) and (iii) as the only possible choices with numbers that could be returned from the list (temp), however the print function (fixed like)
print(temp[i],":",end="#")
Would give an output like
10 :#20 :#30 :#
If c = 3
So none of the options are actually correct.