1.

How will you create a list in python? Explain with syntax and examples?

Answer»

In python, a list is simply created by using square bracket. The elements of list should be specified within square brackets. The following syntax explains the creation of list.

Syntax:

Variable = [element – 1, element – 2, element – 3 element – n]

Example:

Marks = [10, 23, 41, 75]



Discussion

No Comment Found