Computer Science, asked by sakshi7355, 1 year ago

whta does append method in list in python?​

Answers

Answered by Anonymous
1

Append Method:

Append method appends an object to the end of the list. Whatever the object is, whether a number, a string, another list, or something else, it gets added onto the end of my_list as a single entry on the list. So keep in mind that a list is an object.

Explanation:

  • If you append another list onto a list, the first list will be a single object at the end of the list. extend(): Iterates over its argument and adding each element to the list and extending the list. The length of the list increases by number of elements in it's argument.
  • Python list: difference between append and extend. When manipulating lists, you have access to two methods called append() and extend. The former appends an object to the end of the list (e.g., another list) while the latter appends each element of the iterable object (e.g., another list) to the end of the list.
Similar questions