Can you append multiple items to a list Python?

 Yes, of course, we can append multiple items to a list using python.

What is the list: The list is used to storing multiple items in a single variable.

The list is used to storing the collection of data.

If you want to add a single item to a list, use the append method. The append method adds the item to the end of the list.

          List = [1,2,3,4,5]

List.append(6)

print(List)

Output:

[1,2,3,4,5,6]

If you want to append multiple items to a list, use the extend method. The extend method adds multiple items to the end of the list.

List1 = [1,2,3,4,5]

List1.extend = [6,7,8,9]

print(List1)

Output:

[1,2,3,4,5,6,7,8,9] 

Comments

Popular posts from this blog

proassignment help backlink data index 41

Programming shark backlink data index 67

programming shark backink data index 31