Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • You can't extend with just 6 since it's not iterable. And the second output in your example is wrong. 'abc' gets added as a single element since you passed it in to extend as a list with one element ['abc']: [1, 2, 3, 4, 5, 'abc']. To make your example output correct, change the abc line to: x.extend('abc'). And remove the x.extend(6) or change it to x.extend([6]). Commented Sep 25, 2014 at 9:28
  • Also "The extend() method takes one argument, a list," is wrong Commented Feb 4, 2022 at 9:51