How to delete a set using the "del" keyword in Python

Overview

Python’s del keyword deletes a set completely.

Syntax

del set

Parameter value

The del keyword does not take a parameter value.

Code example

Error: Code Widget Crashed, Please Contact Support

Code explanation

The code above returns an error because myset, the set we tried printing in line 7, no longer exists. This is because we deleted it using the del keyword in line 5.

Free Resources