The del statement can be used to remove an item from a list by referring to its index, rather than its value. For example, if you have a list with five values, like this:
a = [1, 2, 3, 4, 5]
and you want to remove the second listed value (2), you can use del to do so. The second listed value has an index of 1, so to remove the value, the del syntax would need to look like this:
del a[1]
Now a will look like this:
a = [1, 3, 4, 5]
Recommended Python Training
Course: Python 3 For Beginners
Over 15 hours of video content with guided instruction for beginners. Learn how to create real world applications and master the basics.