How To Remove Last Element In A List?
Here is a List:
list = ["Red", "Blue", "Green","Silver", "Yellow", "Gray"]
I want to remove last element from List. How to do this using Python?
Here is a List:
list = ["Red", "Blue", "Green","Silver", "Yellow", "Gray"]
I want to remove last element from List. How to do this using Python?
Using the pop() method in Python, You can delete the last element in a list
list = ["Red", "Blue", "Green","Silver", "Yellow", "Gray"]
list.pop()
print(list)
Output:
['Red', 'Blue', 'Green', 'Silver', 'Yellow']