Remove last element from Tuple Using lists remove() method
Python3
# create a list tu = ( 1 , 2 , 3 , 4 , 5 ) # remove last element tu = list (tu) tu.remove(tu[ - 1 ]) tu = tuple (tu) print (tu) |
Output
(1, 2, 3, 4)
Python program to remove last element from Tuple
Given a tuple, the task is to write a Python program to delete the last element in the tuple in Python.
Example:
Input: (“geeks”, “for”, “geeks”)
Output:(“geeks”, “for”)
Explanation: Here we are deleting the last element of the tuple and finally modifying the original one.