Ad
  • Custom User Avatar

    listen to w-h-a here, he explains this perfectly. Disregard the trolls.

  • Custom User Avatar

    Can we tell the author to change the description?

    You can literally rewrite it from the answer.

    divisble by 4 but not divisible by 100, unless divisble by 400

  • Custom User Avatar

    The test consists huge figures so it takes a lot of time

  • Custom User Avatar

    stauntonjr Unfortunately it was marked as a spoiler. It would probably have helped me, and I may still have been stuck, so I don't think it went too far. I had to skip in the end to see how it had been answered.

  • Custom User Avatar

    Read the instructions again. 1100 is divisible by 4, but also by 100 and not by 400, then it's not a leap year.

    The instructions are all clear.

    No, they are unnecessarily unclear. You are adding more than the instructions say. The instructions literally say:

    • if the year is evenly divisible by 4, then it is a leap year. (they do not say that if it is not divisible by 4 and not divisible by 400, then it is not a leap year (note; that is true independently of whether the year is divisible by 100)).
    • if the year is evenly divisible by 100, then it is not a leap year. (they do not say that if it is not divisible by 400 but divisible by 100, then it is not a leap year).
    • if the year is evenly divisible by 400, then it is a leap year.

    The converse of a conditional is not logically equivalent to its conditional. If you code what the instructions literally say, you will not get the right answer. But the definition is simple:

    A year is a leap year just in case either it is evenly divisble by 4 but not evenly divisible by 100 or it is evenly divisible by 400.

    Code that, and you'll get the right answer.

  • Custom User Avatar

    Enormous thanks for this (Y)!

  • Custom User Avatar

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

  • Custom User Avatar

    Removed input validation.

  • Custom User Avatar

    It's raised as an issue above

  • Custom User Avatar

    Always load libraries at the beginning of your code. The reason is two-fold: those reading your code know exactly what libraries you are using, and it increases the efficiency of your functions (as the function would have to check if that library was loaded everytime it was called).

  • Custom User Avatar

    In the problem description one of the requirements is that the result will always be an integer. So probably wanted only integers submitted in the solutions. 1.0 is equivalent to 1 but in this problem we are also seeing that there is a difference in how we get those two values, / versus //

  • Custom User Avatar

    Python version is working fine.

  • Custom User Avatar

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

  • Custom User Avatar

    Shouldn´t I just add a element to the list. I have done it by append. Even renamed the list.

    Log
    0 #input len
    1 #output len
    Test Passed
    Random Tests
    Log
    2 #input len
    3 #output len
    3 should equal 4

    Quote: "Could you please check the length of input and output (after receiving the output)? The output should have one extra value than input."

  • Custom User Avatar

    There's a whole paragraph in the description explaining what you have to do.

  • Loading more items...