Index

List items can be accessed by index.

list = [1, 2, 3]

for i in range(len(list)):
    print("list[%d]: %d" % (i, list[i]))



Output:

list[0]: 1
list[1]: 2
list[2]: 3

results matching ""

    No results matching ""