+ 4
hi Komal, variables can be deleted if they are no longer required. This does not make sense with vars that contain only a few bytes, but can help to keep memory consumption low. If you use lists or arrays with a high amount of data deleting vars is ok.
sample:
names = ['Paul', 'Peter', 'Mary']
print(names)
# will work properly and print the complete list
names.clear()
# clear() does only empty the variable but keeps the name
print(names)
# does print an empty list
del names
# this deletes the var as object
print(names)
# this creates an error:
# NameError: name 'names' is not defined



