1

The following Python 3 code creates a list of lists but when you attempt to change a particular value, the value corresponding to row 2 and column 1, each of the corresponding values in the remaining lists is changed. How do you only change the specified value?

list_of_num = [[0,0]] * 4
print('List of lists:')
print(list_of_num)
list_of_num[1][0] = 1 
print('List of lists:')
print(list_of_num)
Andrew
  • 281
  • 3
  • 15

0 Answers0