Explanation:
Statement 1: a = [1, 2, 3]
A list named a is created.
It stores three values: 1, 2, and 3.
Statement 2: a.append(4)
The append() method adds 4 to the end of the list.
The list is updated directly.
New value of a is:
[1, 2, 3, 4]
This method returns None.
Statement 3: print(a.append(4))
First, a.append(4) runs.
Since append() returns None, print() prints None.
Output
None

0 Comments:
Post a Comment