How to make a list in Python

Defining a list in Python is really quite simple. All that’s needed is to give a name to the list and then initialize by providing it with values.

For example:

myExampleList = [element1, element2, element3,...]

Initializing a list of strings

myStringList = ["Learn", "python","with","Educative"]
print(myStringList)
svg viewer

Accessing elements

Similar to most other programming languages, lists in Python are zero indexed.

For example:

myIntList = [1, 3, 5 ,2, 4]

We will use myIntList[0] to get the first element from the list, that is, 1.

svg viewer
myIntList = [1,3,5,2,4]
print(myIntList[3])

Note: You can create an empty list: lst = [] or lst = list()

New on Educative
Learn to Code
Learn any Language as a beginner
Develop a human edge in an AI powered world and learn to code with AI from our beginner friendly catalog
🎁 G i v e a w a y
30 Days of Code
Complete Educative’s daily coding challenge every day in September, and win exciting Prizes.

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved