Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / Python

list.append

Appends one object at the end of a mutable list.

Version: Python 3.14; repository image, production runtime not attested

Syntax

a.append(value)

Appends one object at the end of a mutable list.

Passing a list adds that list as one nested element. The method mutates its receiver and returns None.

The receiver gains exactly one element. Here that element is the entire two-item list, so the result has two outer elements rather than three. Printing the method call displays None because the list is modified in place.

a = []
v = [1]
assert a.append(v) is None and a[0] is v

Examples

a = [2]
print(a.append([3, 4]))
print(a)

Result

None
[2, [3, 4]]

The receiver gains exactly one element. Here that element is the entire two-item list, so the result has two outer elements rather than three. Printing the method call displays None because the list is modified in place.

Sources