Question: Using python Define a PuzzlePiece class. This class is a little similar to the Node class from our notes on Binary trees. The PuzzlePiece class
Using python

Define a PuzzlePiece class. This class is a little similar to the Node class from our notes on Binary trees. The PuzzlePiece class must have two attributes: connected pieces and secret_id. The connected pieces attribute should be used to save all the other puzzle pieces that the current piece is connected to in a list. It should initially start as an empty list. The secret_id attribute will be used to keep track of which piece is which when testing the code, but otherwise isn't too important. The following methods must also be defined in this class: a) Define a connect to method which takes in two inputs self and other and appends each of them to each other's connected-pieces attribute. b) Define a --str-- magic method which simply returns the secret_id of the object. Again, this will help with testing your code
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
