Unexpected Behavior of Extend with a list in Python [duplicate]

The extend() method appends to the existing array and returns None. In your case, you are creating an array — [4, 5, 6] — on the fly, extending it and then discarding it. The variable b ends up with the return value of None.

Leave a Comment