When trying to remove a number from a particular list that has xy-coordinates in a list-of-lists, python removes that number from (nearly) all lists with different coordinates too. How do I prevent this from happening?
So I'm trying to write a code that can solve Sudokus, but something goes wrong when I run it. The idea is that the code keeps track of which options are still available for every spot. These options are saved in a list-of-lists, with all the sets of options being lists on their own. My code has way too many numbers in it, so I'll use a simplified version here.
options = [1, 2, 3]
board = [[options for c in range(2)] for r in range(2)]
''' which gives the following board:
[[[1, 2, 3], [1, 2, 3]],
[[1, 2, 3], [1, 2, 3]]] '''
board[0][0].remove(1)
What I want this code to do (and I thought it should) is to remove the option '1' only from the options at (0, 0), but it removes '1' from the options at all coordinates. How can I have the code do what I want it to?