Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (50.2k points)
Can anyone tell me how to define a List in Python?

1 Answer

0 votes
by (108k points)

A list is just a dynamically sized array that is used to have multiple sets of elements in a single variable. To create a list in Python, you can just use [] for declaring the list.

For instance:

list1=[‘ele1’, 1.9,2,True]

print(list1)

Lists have the capability of storing multiple data types in a single variable as you can see in the above example, the list stores string type, integer type, float type, and boolean type in a single variable, list1.

If you are looking for an online course to learn Python, I recommend this Python Certification program by Intellipaat.

Related questions

0 votes
1 answer
asked Jul 10, 2020 in Python by ashely (50.2k points)
0 votes
1 answer
0 votes
1 answer
asked Jul 13, 2020 in Python by ashely (50.2k points)
0 votes
1 answer
0 votes
1 answer

Browse Categories

...