Q. What does the Python code: x = [1, 2, 3]; x[1] = 5 print(x) output?

A
[1, 2, 3]
B
[1, 5, 3]
C
[5, 2, 3]
D
[1, 2, 5]
Solution:

The code modifies the element at index 1 (second position) to 5, resulting in the list [1, 5, 3].

Entri PDF Icon

Get Question Bank

Strengthen Your Practice with our comprehensive question bank.

Entri Contact Image

Get Expert Advice for Free: Register for Your Free Consultation Now!