If I have a 2D list called “shoe_sizes”
shoe_sizes = [[“Player0”, “Samir”, 8.5], [“Player1”, “Sally”, 5.6]]
and I want to change Player1 shoe size (3rd parameter) how do I call it?
Would it be index[1][2]
??
If I have a 2D list called “shoe_sizes”
shoe_sizes = [[“Player0”, “Samir”, 8.5], [“Player1”, “Sally”, 5.6]]
and I want to change Player1 shoe size (3rd parameter) how do I call it?
Would it be index[1][2]
??
Yes, you are correct. To change the shoe size of Player1, you would need to access the element at index [1][2] of the shoe_sizes list. For example, if you want to change it to 6.0, you could write:
shoe_sizes = [["Player0", "Samir", 8.5], ["Player1", "Sally", 5.6]]
shoe_sizes[1][2] = 6.0
The first index [1] chooses the interior list and the second index [2] chooses the value inside