🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X

नीचे दिए गए कोड स्निपेट में ___ क्या होगा?

What will be the output of the following code snippet?

a=[1,2,3,4,5,6,7,8,9]
a[::2]=10,20,30,40,50,60
print(a)
A)
B)
C)
D)

Explanation:

You are trying to replace 5 elements (from indices 0, 2, 4, 6, 8) with 6 new values. This causes a mismatch in size, resulting in a ValueError.

So, the answer is (A) ValueError: attempt to assign sequence of size 6 to extended slice of size 5.

Latest Updates