adplus-dvertising
frame-decoration

Question

What is the output of the following code?
lst=[3,4,6,1,2]
lst[1:2]=[7,8]
print(lst)

a.

[3, 7, 8, 6, 1, 2].

b.

Syntax error

c.

[3,[7,8],6,1,2].

d.

[3,4,6,7,8].

Posted under Python

Answer: (a).[3, 7, 8, 6, 1, 2].

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of the following code?