Change individual elements of a list : List Indexing « List « Python






Change individual elements of a list

Change individual elements of a list
 

a = ['spam', 'eggs', 100, 1234]
print a

a[2] = a[2] + 23

print a


           
         
  








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.Reference index in a list in Python.Reference index in a list in Python.
5.Searching a list for an integer.
6.List: display one item through an indexList: display one item through an index