Ad
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    I didn't claim it would be.
    However… if anywhere, I think it's acceptable especially in a narrow use case, such as a coding exercise. THe reason: Precisely because it's a narrow use case, it won't cause harm elsewhere.

    That said, using refinements would have been a cleaner way to achieve the effect, without reopening standard classes.

    In a real system that deals with geometrical objects, I'd expect that each of these objects would respond to area anyway.

  • Custom User Avatar

    Then it won't work, but the instructions say: Create a five_num method that takes an array of integers as an argument
    so checking for invalid input is not a requirement.