All challenges
Multiple ChoiceIntermediate 30s

__str__ vs __repr__

Choose the best answer for: string representations
Options
  1. 1__str__ and __repr__ are identical and produce same text
  2. 2Only __str__ exists; __repr__ is not a real dunder
  3. 3__str__ is for user-friendly display, __repr__ for debugging
  4. 4__repr__ is called by print() first before __str__

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle