1colors = ["red", "green", "blue", "purple"]
2
3for i in range(len(colors)):
4 print(colors[i])
5
1# Find index position of first occurrence of 'Ok' in the list
2indexPos = listOfElems.index('Ok')
3
4print('First index of element "Ok" in the list : ', indexPos)
5
1# To get value from index in a list:
2x = ["Foo", "Bar", "Roblox"]
3
4print(x[0]) # Output: Foo
1test = [ 'test 1', 'test 2', 'test 3' ]
2for index, value in enumerate( test ):
3 print( index, value )