delte python code example
Example 1: 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']
Example 2: how to delete in python
#x will be deleted
print("x\b")