Isa
0
Q:

python dlist

# example of list in python

myList = [9, 'hello', 2, 'python']

print(myList[0]) # output --> 9
print(myList[-3]) # output --> hello
print(myList[:3]) # output --> [9, 'hello', 2]
print(myList) # output --> [9, 'hello', 2, 'python']
22
thislist = ["apple", "banana", "cherry"]
print(thislist[1])
8
#this is how  to create a list:
#I named it mylist, but you can name it whatever you like

myList = [1,2,3,4,5]
print(myList[0]) # this will print the first element of the list
print(myList[1]) #this will print the second element of the list
print(myList[2])#and so on
print(myList[3])
print(myList[4])
2

New to Communities?

Join the community