

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How do we define lists in Python?
A List is a sequence data type in Python. It is a comma separated list of elements, not necessarily of same type, included in square brackets ([ ]). List is an ordered collection. Individual element in a List object can be accessed by a zero based index.
Example
list1 = ['physics', 'chemistry', 1997, 2000]; list2 = [1, 2, 3, 4, 5 ]; list3 = ["a", "b", "c", "d"]
Output
A List object with no element between square brackets is a null list.
list1 = []
- Related Questions & Answers
- How do we define tuple in Python?
- How do we define dictionary in Python?
- How do we compare two lists in Python?
- How do we compare the elements of two lists in Python?
- How do we define a dialog box in HTML?
- How To Do Math With Lists in python ?
- How do we use function literal to define a function in JavaScript?
- How do we define an area in an image map with HTML?
- How can we define a Python function at runtime?
- How do we use enum keyword to define a variable type in C#?
- How do we compare Python Dates?
- How do we declare variable in Python?
- How do we provide comments in Python?
- Can we explicitly define datatype in a Python Function?
- How do we define the start of a term in a definition list in HTML?
Advertisements