The signature for the list comprehension is as follows:
[ expression(var) for var in iterable ]
append() adds the element at the end.
extend() adds the elements of a different list at the end.
The pop() method removes the item at the given index from the list. The method also returns the removed item.
The syntax of the pop() method is:
list.pop(index)
Example:-
language = ['Python', 'Java', 'C++', 'French', 'C']
return_value = language.pop(3)
print('Return Value: ', return_value)
print('Updated List: ', language)
Output:-
Return Value: French
Updated List: ['Python', 'Java', 'C++', 'C']
You can pass your list to the len() function to get the length of your list back.
To concatenate lists, you use the + operator. It will give you a new list that is the concatenation of your two lists without modifying the original ones.