How to add an Item in List in Python?
append() method: append() method is used to add an item to the end of the list. Example: myList = ["List Item 1", "List Item 2", "List Item 3"]myList.append("List Item 4")print(myList) insert() method: insert() method is used to insert a list item at a specified index. myList = ["List Item 2", "List Item 3", "List Item 4"]myList.insert(1, "List Item 1")print(myList) extend() method: extend()...
0 Comments 0 Shares 0 Reviews
Sponsored