Account
Categories

Integer list


Definition:

If you are required to store the data of integers in the form of a list, then you can create an integer list.

Now you will clearly understand this with the help of the diagram.

a = [11, 12, 13, 14]

        ┌────┬────┬────┬────┐
Index → │ 0  │ 1  │ 2  │ 3  │
        ├────┼────┼────┼────┤
Value → │ 11 │ 12 │ 13 │ 14 │
        └────┴────┴────┴────┘

Syntax:

list_name = [int1, int2, int3]

Example:

a = [11, 12, 13, 14]
print(a)

Output:

Create an integer list with values 5, 10, 15, 20 and print it using Python.