1my_list = [123, 'Add', 'Grepper', 'Answer']
2my_list.pop()
3-->[123, 'Add', 'Grepper'] #last element is removed
4
5my_list = [123, 'Add', 'Grepper', 'Answer']
6my_list.pop(0)
7-->['Add', 'Grepper', 'Answer'] #first element is removed
8
9my_list = [123, 'Add', 'Grepper', 'Answer']
10any_index_of_the_list = 2
11my_list.pop(any_index_of_the_list)
12-->[123, 'Add', 'Answer'] #element at index 2 is removed
13 #(first element is 0)
1# Python list method pop() removes
2# and returns last object or obj from the list.
3# .pop() last element .pop(0) first element
4
5my_list = [123, 'Add', 'Grepper', 'Answer'];
6print "Pop default: ", my_list.pop()
7> Pop default: Answer
8# List updated to [123, 'Add', 'Grepper']
9print "Pop index: ", my_list.pop(1)
10> Pop index: Add
11# List updated to [123, 'Grepper']
1# programming languages list
2languages = ['Python', 'Java', 'C++', 'French', 'C']
3
4# remove and return the 4th item
5return_value = languages.pop(3)
6print('Return Value:', return_value)
7
8# Updated List
9print('Updated List:', languages)