Create a List With Python

This post will show how to create a list object with Python and print it out as a whole or using a for loop statement.


A list in Python allows us to store multiple items and later on retrieve them for processing. Lists are structured and hold the information in order.

Create and print a list

In the following code, we create a list and print all of it, and in the second print statement, we print each item in the list separately using a for a loop.

The last line prints a single item from the list.

# Create list
mylist = ["item1", "item2", "item3"]
# Print the entire list
print(f" {mylist} ")

# Use for loop to print each item
for item in mylist:

# Print a single item
print (mylist[0])

Leave a comment

Your email address will not be published.