Unit 5 Session 1 (Click for link to problem statements)
Understand what the interviewer is asking for by using test cases and questions about the problem.
Hand
class behave if trying to remove a card that isn't in the hand?
remove_card
is called.Plan the solution with appropriate visualizations and pseudocode.
General Idea: Develop a Hand
class to manage a collection of Card
objects, providing methods to add and remove cards.
1) Initialize the `Hand` class with an empty list of cards.
2) Implement `add_card()` to append a `Card` object to the hand.
3) Implement `remove_card()` to remove a `Card` object from the hand.
⚠️ Common Mistakes
class Hand:
def __init__(self):
self.cards = []
def add_card(self, card):
self.cards.append(card)
def remove_card(self, card):
self.cards.remove(card)