Ad
  • Custom User Avatar

    You saved my day bro) I started month from 0 and it is not right. Many thanks !!!

  • Custom User Avatar

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

  • Custom User Avatar

    Listen, say whatever you want. This is a Kata with 30% None disapproval - that is the lowest frankly I've ever seen on this site. Not to mention, have you read the comments here? Do you not see a contrast between this and other kata? Why the cognitive disonance?

    Have you considered why 30% of people disapprove and flood the comments for a kata that is essentially a basic algebra problem? No? you don't think there may be issues?

    1. You can't assume anything is "logical". The order is which things happen is arbitrary. It could happen either way and is entirely up to the description of the problem to clarify.

    2. I did think of my months counter that way, after rearranging things and realizing that was how to pass the test cases. If you think this is how it should, why not specify it like you did here? That is exactly what I'm asking for

    3. It is parallel, but not the exact same question and elaborating on a subtopic. Please read the other comments to see how many times my notion has been repeated. The updated description posted by another user captures this quite well.

    4. I made a mistake here and did not clearly elaborate what I meant to say. I am claiming issue here with exactly which months an adjustment to the depriciation is applied; again, you can read the other comments to see my sentiment repeated.

    5. This should be within the parameters and return section, not adjacent to it.

    6. This is the best part of the description.

    I don't understand the kickback. In any interview, exam situation, edge cases and parameters are specified with borderline unnecessary scrutiny. Here is flopped at will and very hard to decipher. There is an explicit reason that this kata is ranked so lowly, and it is absolutely not because people have an issue with introductory alegbra conceptually.

    Lastly, I did understand the task. I am writing here because I solved it. I am also writing here because solving it was a poor use of my time and was a "what did the author intend?" guessing game than an actual programming challenge. Depending on how you arbitrarily interpret your specifications this problem can be done in minutes, brute-force rearranging the order of your code until you chance upon the correct arrangement. It's a few simple lines at most.

  • Custom User Avatar

    Done, thanks again.

  • Custom User Avatar

    Will it remain clear if I remove "fixed in "fixed 0.5"?

    Yes, that'd be better.

  • Custom User Avatar

    I will precise the rounding and that the beginning is an example.
    Will it remain clear if I remove "fixed in "fixed 0.5"?

  • Custom User Avatar

    @FArekkusu: thanks, I can't say better!

  • Custom User Avatar

    The description should be rewritten slightly:

    1. "766 is the nearest integer to '766.158..." - this part is hard to notice. Simply say that the final value should be rounded.
    2. It should be clarified that the example at the beginning is indeed an example, and not part of the task explanation. "Furthermore the percent of loss increases by a fixed 0.5 percent at the end of every two months." - this part is especially baffling because "fixed 0.5" sounds like this value is a constant.
  • Custom User Avatar
    1. Isn't it logical that the percentage should be updated before applying any changes to the cost?
    2. Selling, buying and saving are normally done at end of month - if you think of your months counter as "number of months that have passed", everything is correct because only 1 month passed, NOT 2, and you should not adjust anything.
    3. You're just duplicating your question #1 here.
    4. You're duplicating your question #2 again.
    5. "766 is the nearest integer to 766.158..." -> "nearest integer" -> use round.
    6. The Parameters and return of function part clarifies that all the mentioned values are parameters to the function.

    Not an issue, but question. If 4000 people understood the task while you do not, that's your problem.

  • Custom User Avatar

    This question, as many have stated, has very unclear documentation. This isn't a difficult question by any means, a basic compounded percentage problem. This question however is extremely unclear on multiple points in its description. The ones I caught:

    • The order of each event occuring (depriciation, purchasing and saving) is unclear. The correct order to get the result the test cases one needs to FIRST adjust the percentage if necessary. The ordering for these operations is ultimately arbitrary, but the depriciation percent happening before or after calculations is important to get the exact result.

    • The months where depriciation occurs isn't clear. Month 0 is used as a corner case test, but it isn't clear if month 0 is the first month with depriciation or not. To get this correct, it is before any calculations have taken place (ie, old car is worth 12000 and new is 8000 on the spot, meaning you can purchase it right away with 4000 in savings). Month 1 is therefore the first month that calculations and savings have taken place. This is again, arbitrary to decide but must be clearly stated.

    • The exact method for increasing depriciation is unclear. Does it increase after calculations or before? Again, the trend here is this decision is arbtrary but not clear. This must be explictly stated - right now, the adjustment to the percentage happens before any calculations take place.

    • The months that have depriciation are not clear stated. Make it clear that month 0 is before any calculations, month 1 is with calculations and no adjustments, and then month 2 calculates the depriciation at the beginning of the month, the pattern continues etc.

    • The rounding is arbitrary - it could just as easily be a floor as a round and neither perfectly makes sense (it is necessary, given that the result is a floating point number). Make it clear the answer needs to be rounded to the nearest integer (it is stated but not exactly clear).

    • Please, please remove the constants from the description as though they are set in stone. Accurately refer to the fact that the monthly savings are a variable instead of simply saying "1000" but inconsistently refering to other variables correctly as variables.

    Ultimately, this is a very simple Kata, a little bit of a brain teaser to make programmers aware of floating point accuracy and such. But with something as sensitive to results like this, the instructions have to be watertight. Otherwise you will dissuade/discourage many programmers who are getting very close answers that are slightly off, where the only solution is to continously reorder operations until you can guess what the submitter was thinking at the time.

  • Custom User Avatar

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