0% found this document useful (0 votes)
3 views1 page

Nested List

The document explains the concept of nested lists, which can contain heterogeneous elements and other lists as elements. It provides an example of a nested list and mentions that such lists can be used to create matrices, allowing operations like addition, subtraction, and multiplication. Additionally, it indicates that operations can be performed on nested lists similar to matrices.

Uploaded by

r_r_arora26
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Nested List

The document explains the concept of nested lists, which can contain heterogeneous elements and other lists as elements. It provides an example of a nested list and mentions that such lists can be used to create matrices, allowing operations like addition, subtraction, and multiplication. Additionally, it indicates that operations can be performed on nested lists similar to matrices.

Uploaded by

r_r_arora26
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Nested List

• A list can have heterogeneous elements like int , oat etc.


• A list can have a list as an element inside it this is called nested list for example
Ex : list = [10, 20 [ ‘ a ’, ‘ b ’ [ ‘ c ’, ‘ d ’] , 30 , 40 ] ]

• Diagrammatically it can be represented as

• If you are having nested list you can prepare a matrix also with same type of values . Lets, see
this in a program

# A, B are 2 list in which nested list resides


On this 2 list we are performing addition and
appending the results in C and printing the
result

• Just like + you can also perform - , * on a matrix


fl

You might also like