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#

27th Nov 2020, 5:30 AM
Model Pilot
Model Pilot - avatar
1 Réponse
+ 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.
27th Nov 2020, 6:59 AM
ChaoticDawg
ChaoticDawg - avatar
Aujourd'hui en vedette
What?
0 Votes
HTML
0 Votes
Quiz duel
0 Votes
FRC Coding?
1 Votes
help
0 Votes
AI
2 Votes
APIs
1 Votes
Create Agent
0 Votes