del keyword python code example
Example: python del
# Delete Variables
my_var = 5
my_tuple = ('Sam', 25)
my_dict = {'name': 'Sam', 'age': 25}
del my_var
del my_tuple
del my_dict
# Delete item from list
my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9]
# deleting the third item
del my_list[2]
# Delete from dictionary
person = { 'name': 'Sam',
'age': 25,
'profession': 'Programmer'
}
del person['profession']