7 kyu

Building Spheres

2,242 of 2,988NaMe613
Description
Loading description...
Object-oriented Programming
Fundamentals
  • Please sign in or sign up to leave a comment.
  • saudiGuy Avatar
  • RileyHunter Avatar

    As per my comment below, the handling of uncertainty in this kata is pretty weird. Solutions are required to deliver answers with higher precision than the inputs, and therefore coders must either:

    1. Think about the numerical analysis of their solution (not really a 7-kyu thing)
    2. Fiddle around with the algebra until they stumble on a correct solution or get lucky with the random tests (not great for learning IMO)

    For reference the uncertainty on the volume of a sphere with radius 1000+-0.005 (rounded to 2DP as in this kata) is about +-157, whereas the kata asks for an answer accurate to +-0.000005

    I suggest one of the following be applied:

    1. Test answers to within a percentage of the expected value rather than to a static 5DP; Gaussian error approximation for the most complex of these calculations is about 0.03%, which would prevent most issues.
    2. The description be updated to mention the need for accuracy, and some hints about how to do that (e.g. avoid rounding on intermediate values) could be added.
  • Leqso06 Avatar

    This comment has been hidden.

  • Antinomiste Avatar

    Test cases marked as True or as False by a few decimals points, depending on whether some multiplication is put first or last. That is a serious bug. Test should not exactly compare floats !

  • Haksell Avatar

    That's not how Python classes are supposed to work... There is no point in point in implementing get_mass when you can already use the attribute .mass. And even the three that are not direct attributes should use @property instead of a method.

  • Blind4Basics Avatar
    • all issues resolved
    • description updated
    • tests failure messages added
    • python version made compatible with python 3 to avoid pita problems with floor division for the beginners...
    • ... approved, so.
  • stackcats Avatar

    This comment has been hidden.

  • keenman76 Avatar

    Instruction text should provide formulas needed and test failures should state which test failed with what input data.

  • BrandonHeinrich Avatar

    What is the Sphere is created with a mass/radius with greater that 5 digits of percision? Should the getters round those too?

  • rolandas Avatar

    This comment has been hidden.

  • HamzaSaadi Avatar

    This comment has been hidden.

  • lightstalker Avatar

    tests need more constructive feedback, if testing only programming skills then formula for sphere should be supplied

  • CIS 122 Avatar

    You need to use some fuzz when comparing values in Python. It took me longer to figure out exactly why my answers were off by 0.00001 then it took to write the code in the first place. Rounding differences between multiplying first and then dividing vs. dividing first and then multiplying.