Reference index in a list in Python. : List Indexing « List « Python






Reference index in a list in Python.

Reference index in a list in Python.
 


foo = [42, 'www.java2s.com', lambda x: x**2, [47, '11']]

print foo


print foo[3]


print foo[2](3)

foo[3][0] = 99
print foo


for i in foo:
     print i, "--", type(i)


           
         
  








Related examples in the same category

1.List offset: start at zero, negative and slicingList offset: start at zero, negative and slicing
2.List value assignment and index referenceList value assignment and index reference
3.Negative List IndicesNegative List Indices
4.Change individual elements of a listChange individual elements of a list
5.Searching a list for an integer.
6.List: display one item through an indexList: display one item through an index