Skip to content

What is list in Python | Basics

  • by

Python List is the built-in data type used to store multiple items in a single variable. Python has 3 more data types Tuple, Set, and Dictionary to store multiple value data for different purposes.

You can easily create a list by using square brackets, where the elements are placed inside square brackets ([]), separated by commas

mylist = ["A", "B", "C"]

Example code list in Python

Simple example code. An important point about List is List elements are ordered, changeable, and allow duplicate values.

furit_list = ["apple", "banana", "cherry"]

print(furit_list)

print(type(furit_list))

Output:

What is list in Python

List items can be of any data type:

list1 = ["A", "B", "C"]

list2 = [1, 5, 7, 9, 3]

list3 = [True, False, False]

Do comment if you have any doubts or suggestions on this Python basics topic.

Note: IDE: PyCharm 2021.3 (Community Edition)

Windows 10

Python 3.10.1

All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.