Functions

The list(), dict(), tuple(), and set() functions may be used to create list, dictionary, tuple, and set objects, respectively.

print(list((1, 2, 3)))
print(dict(one = 1, two = 2, three = 3))
print(tuple((1, 2, 3)))
print(set((1, 2, 3)))

Output:

[1, 2, 3]
{'three': 3, 'two': 2, 'one': 1}
(1, 2, 3)
{1, 2, 3}

results matching ""

    No results matching ""