Answered by : loic
# Create a list
new_list = []
# Add items to the list
item1 = "string1"
item2 = "string2"
new_list.append(item1)
new_list.append(item2)
# Access list items
print(new_list[0])
print(new_list[1])
Source : | Last Update : Wed, 10 Jun 20
Answered by : smiling-sloth-hw69tkzfly1v
myList = [value,value,value] #note that you can use any amount of value
#you don not have to use value
Source : | Last Update : Wed, 11 Nov 20
Answered by : devarghya-chakraborty
listName = [whatever,whatever,etc.]
Source : | Last Update : Fri, 08 Jan 21
Answered by : important-ibis-w15zx32eafiy
#creating a list
create_list = ["apple", "banana", "cherry"]
print(create_list)
Source : | Last Update : Wed, 07 Oct 20
Answered by : devarghya-chakraborty
list = [integers seperated by commas]
Source : | Last Update : Fri, 08 Jan 21
Answered by : devarghya-chakraborty
blah = [uchoose,etc.]
Source : | Last Update : Fri, 08 Jan 21
Answered by : average-angelfish-swfqezpyddfh
list = [1, 2, 4, 5, 6]
Source : | Last Update : Sat, 16 May 20
Answered by : energetic-elephant-7mmzs28zzn5a
list1 = ['physics', 'chemistry', 1997, 2000];
list2 = [1, 2, 3, 4, 5 ];
list3 = ["a", "b", "c", "d"];
Source : https://www.tutorialspoint.com/python3/python_lists.htm | Last Update : Fri, 26 Feb 21
Answered by : david-cao
my_list = ['p', 'r', 'o', 'b', 'e']
# first item
print(my_list[0]) # p
# third item
print(my_list[2]) # o
# fifth item
print(my_list[4]) # e
# Nested List
n_list = ["Happy", [2, 0, 1, 5]]
# Nested indexing
print(n_list[0][1])
print(n_list[1][3])
# Error! Only integer can be used for indexing
print(my_list[4.0])
Source : https://www.howtouselinux.com/post/create-a-list-in-python | Last Update : Mon, 30 May 22
Answered by : handsome-hummingbird-2vygah0w072x
# list with numbers
list = [10, 20, 30]
# list with strings
list = ["john", "kai", "albert"]
# mixed data
list = ["john",1 ,True ]
Source : | Last Update : Sun, 14 Jun 20