python working with lists code example
Example 1: how to make a python list
listName = [1,2,3,4]
Example 2: how to make a list python
list = ['list element', 'list element']
# or t obe more effecient:
import numpy #if you do not have numpy, do "pip install numpy"
numpyarray = numpy.array(['array element', 'array element'])
#a numpy array is faster than a standard list
Example 3: python list and list
a = ['apple', 'banana', 'pear']
b = ['fridge', 'stove', 'banana']
a & b == ['banana'] #True
Example 4: python dlist
#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])