Challenge 2: A Printable Fraction Class — Possible Solution ==================================================================== class Fraction: def __init__(self, numerator, denominator): self.numerator = numerator self.denominator = denominator def __str__(self): return f"{self.numerator}/{self.denominator}" half = Fraction(3, 4) print(half) Output: 3/4 WHY THIS WORKS AS AN ANSWER ------------------------------ __init__(self, numerator, denominator) reuses the plain instance-attribute pattern from Chapter 1 — self.numerator and self.denominator are set directly from the constructor's arguments, nothing new here. __str__(self) reuses this chapter's own Point class example exactly: defining a method with that specific dunder name teaches Python what string to produce whenever the object is passed to print() (or str()). Without it, print(half) would fall back to the default, unhelpful "<__main__.Fraction object at 0x...>" representation the chapter described. The f-string f"{self.numerator}/{self.denominator}" inside __str__ reuses ordinary f-string formatting from Course 1, just applied to two instance attributes instead of local variables — building the "3/4"-style string the challenge asks for. print(half) then automatically calls __str__ behind the scenes and prints its return value, with no explicit .toString()-style call needed at the call site.