type of list python code example
Example 1: how to create a list in python
new_list = []
item1 = "string1"
item2 = "string2"
new_list.append(item1)
new_list.append(item2)
print(new_list[0])
print(new_list[1])
Example 2: list in python
thislist = ["apple", "banana", "cherry"]
print(thislist[1])
Example 3: how to make a list in python
list = [1, 2, 3, 4, 5, 6, 7]
Example 4: python dlist
myList = [1,2,3,4,5]
print(myList[0])
print(myList[1])
print(myList[2])
print(myList[3])
print(myList[4])
Example 5: python list
List = list()
List = []
List = [0, "any data type can be added to list", 25.12,
("Even tuples"), {"Dictionaries": "can also be added"},
["can", "be nested"]]
List[1]
List[-1]
List.append(4)
List.pop(n=-1)
List.count(25.12)