English

What possible output is expected to be displayed on the screen at the time of execution of the Python program from the following code? import random L=[10,30,50,70] Lower=random.randint(2,2)

Advertisements
Advertisements

Question

What possible output is expected to be displayed on the screen at the time of execution of the Python program from the following code?

import random
L=[10,30,50,70]
Lower=random.randint(2,2)
Upper=random.randint(2,3)
for K in range(Lower, Upper+1):
   print(L[K], end="@")

Options

  • 50@70@

  • 90@

  • 10@30@50@

  • 10@30@50@70@

MCQ
Advertisements

Solution

50@70@

Explanation:

Lower is always 2, and Upper can be 2 or 3.
So the loop prints elements from index 2 to 3 → L[2] = 50, L[3] = 70, giving 50@70@.

shaalaa.com
  Is there an error in this question or solution?
2025-2026 (March) Board Sample Paper
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×