Complete the code to separate the game state from the display logic.
class GameModel: def __init__(self): self.score = 0 class GameView: def display_score(self, model): print('Score:', model.[1])
The view should access the score attribute from the model to display it.
Complete the code to update the game model without changing the view.
class GameModel: def __init__(self): self.lives = 3 def lose_life(self): self.[1] -= 1
The lose_life method should decrease the lives attribute in the model.
Fix the error in the view code that incorrectly modifies the model.
class GameView: def update_score(self, model, points): model.[1] = points # Incorrect: view should not modify model directly
The view should not change the model's score directly; this breaks separation of concerns.
Fill both blanks to implement a controller method that updates the model and triggers the view update.
class GameController: def __init__(self, model, view): self.model = model self.view = view def add_points(self, points): self.model.[1] += points self.view.display_score(self.model.[2])
The controller updates the model's score and then tells the view to display the updated score.
Fill all three blanks to complete the MVC pattern: model update, view display, and controller method name.
class GameController: def [1](self, points): self.model.[2] += points self.view.[3](self.model)
The controller method add_points updates the model's score and calls the view's display_score to show the change.
