1myList = [apples, grapes]
2fruit = input()#this takes user input on what they want to add to the list
3myList.append(fruit)
4#myList is now [apples, grapes, and whatever the user put for their input]
1# to add an item to a list
2list.append(item)
3
4# To extend an list with a new list
5list1.extend(list2)
1#Add item to python list
2languages = ['C', 'Kotlin', 'Javascript']
3user_input = input('Enter a programming language...')
4languages.append(user_input)
5for i in languages:
6 print(i)
7#Result
8>>Enter a programming language...[ Python| ]
9>>'C'
10>>'Kotlin'
11>>'Javascript'
12>>'Python'
1#append to list
2lst = [1, 2, 3]
3li = 4
4lst.append(li)
5#lst is now [1, 2, 3, 4]
6
7.append("the add"): append the object to the end of the list.
8.insert("the add"): inserts the object before the given index.
9.extend("the add"): extends the list by appending elements from the iterable.