Print the element values assigned to the list value

Print the list value in python programming language. This program will print the list value which is initialized in program for data structure. This program is very similar to the previous program in data strucuture in python programming language.

The built-in list type “list” in Python is fantastic. Within square brackets [ ], list literals are written. Lists are similar to strings in that they are accessed using the len() function and square brackets [ ], with the first entry at index 0.

num = [1,2,3,4,5,6]
print(num[0])
print(num[3])
print(num[5])

Output:

1

4

6

What is list and how it is different from tuples and dictionary

Along with tuples, dictionaries, and sets, lists are one of Python’s four built-in data structures. They are used to hold an organised collection of objects that may or may not be of distinct sorts. The components included within a list are separated by commas and surrounded in square brackets.

How the list is useful in python

When you need to work with a large number of linked values, lists are ideal. They let you to keep data that belongs together together, compress your code, and apply the same methods and actions to numerous variables at the same time.