Need help with Data Hiding Code Coach
I'm working on the code coach for data hiding. Here's the prompt: We are working on a game. Our Player class has name and private _lives attributes. The hit() method should decrease the lives of the player by 1. In case the lives equal to 0, it should output "Game Over". Complete the hit() method to make the program work as expected. And here's my code so far: class Player: def __init__(self, name, lives): self.name = name self._lives = lives def hit(self): if self._lives == 0: print("Game Over") else: self._lives = self.lives - 1 p = Player("Cyberpunk77", 3) p.hit() p.hit() p.hit() It never outputs anything. Can someone tell me how to correct this? Thanks in advance