Hapus tuple dari daftar python
tuples = [("a", "b"),("c", "d")]
tuples.remove(("a", "b"))
panda
tuples = [("a", "b"),("c", "d")]
tuples.remove(("a", "b"))
# Deleting a Tuple
Tuple1 = (0, 1, 2, 3, 4)
del Tuple1
print(Tuple1)
list_of_tuples = [('Alba', 'Texas'), ('Abernathy', 'Texas'), ('Abilene', 'Texas')]
list_of_tuples.remove(('Alba', 'Texas'))
#OR
list_of_tuples.pop(list_of_tuples.index(('Abernathy', 'Texas')))
# Deleting tuples
my_tuple = ('p', 'r', 'o', 'g', 'r', 'a', 'm', 'i', 'z')
# can't delete items
# TypeError: 'tuple' object doesn't support item deletion
# del my_tuple[3]
# Can delete an entire tuple
del my_tuple
# NameError: name 'my_tuple' is not defined
print(my_tuple)