adplus-dvertising
frame-decoration

Question

What is the output of the following code?
a=[1,2,3]
b=a.append(4)
print(a)
print(b)

a.

[1,2,3,4].

b.

[1, 2, 3, 4].
None

c.

Syntax error

d.

[1,2,3].
[1,2,3,4].

Posted under Lists in Python Python

Answer: (b).[1, 2, 3, 4].
None

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?