Question · Python course · Module 3: Object-Oriented Programming

__str__ vs __repr__

What is the difference between __str__ and __repr__?

Answer options

  • __str__ for the user, __repr__ for the developer
  • They are identical
  • __repr__ for the user, __str__ for the developer
  • __str__ is deprecated

You can check the correct answer by solving this task in the CodeWorlds game.