HomeToolsAbout

What is a Set

Set Conversion

Creating a set from an array would be a O(n) operation.

Creating an array (list) from set would also be a O(n) operation.

Javascript

Python

newList = {"one", "two", "three"} newSet = set(newList)

Nested iteration

# creating set from list (array) my_list = [[2, 4], [2, 6], [2, 8]] my_set = {e for l in my_list for e in l}
AboutContact