oaker
0
Q:

python get index and value from list

test = [ 'test 1', 'test 2', 'test 3' ]
for index, value in enumerate( test ):
  print( index, value )
1
list.index(element)
13
# To get value from index in a list:
x = ["Foo", "Bar", "Roblox"]

print(x[0]) # Output: Foo
2
#Example List
list = ['apples', 'bannas', 'grapes']
#Use Known Entites In The List To Find The Index Of An Unknown Object
Index_Number_For_Bannas = list.index('apples')
#Print The Object
print(list[Index_Number_For_Bannas])
9
list.index(element, start, end)
3
list.index(element
0

New to Communities?

Join the community