Answers for "convert list of array to set of array python"

1

convert array to set python

# Simple example:

list_ex = [1, 2, 3, 4]
list_set = set(list_ex)

# Printing the newly-created set should yield the following result:
# {1, 2, 3, 4}

# If you have a matrix (list of lists), you can convert 
# it to a set by following this example:
matrix_ex = [[1, 2], [3, 4], [5, 6]]
matrix_set = {e for l in matrix_ex for e in l}
Posted by: Guest on July-19-2021

Code answers related to "convert list of array to set of array python"

Python Answers by Framework

Browse Popular Code Answers by Language