Language Syntax
Set comprehension — Python syntax
Construct a set eagerly from selected hashable results. Equal values collapse; iteration order is not guaranteed.
Formal Syntax & Structure
python syntaxpython
{expression for target in iterable if condition}Return Value
set
Value obtained by evaluating this expression; see description for context and constraints.
Working Example
Example Snippetpython
words=['API','api','SQL']print(sorted({w.lower() for w in words}))