Imagine you are developing a game and you have a Player class. Every player has a unique ID and a score. Which method would be best suited to fetch the highest score across all players without needing an instance of the player class?

  • classmethod
  • instance method
  • property
  • staticmethod
To fetch the highest score across all players without needing an instance of the player class, you should use a staticmethod. Static methods are called on the class itself and don't require an instance, making them suitable for tasks that don't involve instance-specific data.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *