Lists

Python supports a number of compound data types used to group other values. The most versatile is the list, which can be written as a list of comma-separated values (items) between square brackets. Lists might contain items of different types, but usually the items all have the same type.

list = [1, 2, 3]

for item in list:
    print(item)


Output: 

1
2
3

results matching ""

    No results matching ""