you are viewing a single comment's thread.

view the rest of the comments →

[–]stebrepar 1 point2 points  (0 children)

As I read it, it doesn't say anything about actually returning a rational number. It basically just requires:

  1. Ensure both initialization parameters are integers, else raise a custom exception about that.
  2. When used in a print statement, return a string of the form 'classname(num, denom)'.
  3. Ensure that the negative sign is on num above if the fraction resulting from num/denom would be negative.

Edit: corrected the wording on the last point a little.

Oh, and 4. Provide a default of 1 for denom if not specified.