/* */

Tuesday 22 March 2011

Changing Lists

- assignment:
x = [1,1,1] - Declare list and its values
x[1] = 2 - Assign value of 2 to position 1
x
[1,2,1,] - New value of x

To change list items, index the item you want to change (x[1]) and assign a new value to it (x[1] =2).

No comments:

Post a Comment