Data Types

The data types for a list, dictionary, tuple, and set, are 'list', 'dict', 'tuple', and 'set', respectively.

list = [1, 2, 3]
dictionary = {1: "one", 2: "two", 3: "three"}
tuple = (1, 2, 3)
set = {1, 2, 3}

print("list:", type(list))
print("dictionary:", type(dictionary))
print("tuple:", type(tuple))
print("set:", type(set))


Output:

list: <class 'list'>
dictionary: <class 'dict'>
tuple: <class 'tuple'>
set: <class 'set'>

results matching ""

    No results matching ""