Skip to content
How do we make a list on python?
Profile icon

I need help making a list in python.

You are viewing a single comment. View All
Profile icon

A list is basically a collection which is ordered and can be changed.
You just do it like this:

my_list = [“item1”, “item2”, “item3”, “item4”] # replace those with what you want. # you can have as much values inside as you want

You can also access certain parts of the list with indexes. Indexes always start at 0


food = [“pizza”, “hotdog”, “rice”] print (food[0]) # this will print “pizza” because it is the first value of the list. print (food[2]) # will print “rice”

reminder: lists always start at index 0, so pizza is at index 0, hotdog at index 1, and rice at index 2.

For more help check these out:

Happy coding and hope this helps! =)