Sarthaks Test
0 votes
in Computer by (48.2k points)
closed by

What possible outputs(s) are expected to be displayed on screen at the time of execution of the program from the following code? Also specify the maximum values that can be assigned to each of the variables Lower and Upper.

import random AR=[20,30,40,50,60,70]; 

Lower =random.randint(1,3) 

Upper =random.randint(2,4) for K in range(Lower, Upper +1): 

print (AR[K],end=”#“) 

(i) 10#40#70# 

(ii) 30#40#50# 

(iii) 50#60#70# 

(iv) 40#50#70#

1 Answer

+1 vote
by (50.8k points)
selected by
Best answer

OUTPUT: (ii) 

Maximum value of Lower: 3 

Maximum value of Upper: 4

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.