Ad
  • Custom User Avatar

    The tests are fine, it's your job to make that work:

    or says Hello, World! if name is not given (or passed as an empty String).

  • Default User Avatar

    I just tried the code from your link, it fails. Try running print(series_sum(58)), it prints 2.4, not 2.40.

  • Custom User Avatar

    I forked your code to add this line: print(series_sum(58)) it prints 2.4, not 2.40

  • Default User Avatar

    Floating point numbers in python will eliminate extreneous 0's by default. You can try this:

    x = 2.4000000000000000000000000000000000
    print(x)
    

    The above will output 2.4. In your code, for this test specifically, you are getting a result for sum of 2.3965..., then you are rounding it to 2 decimal places to produce what would be 2.40, but because it's a floating point number and that last 0 doesn't matter, it actually produces 2.4. You then convert it to a string to make '2.4'. I don't know why this works differently in jupyter notebook for you. If I had to guess, you probably have the test set up incorrectly. Either that, or there's a big problem with the way jupyter notebook handles float values in python.

    Edit: I just tried your code on jupyter notebook's online demo thing, and it fails there as well.

  • Custom User Avatar

    Tried your code in Repl.it and it also fails there.

  • Custom User Avatar
  • Default User Avatar

    This is a question, not an issue. An issue is a bug in the kata itself.

    From the description:

    You need to round the answer to 2 decimal places and return it as String.
    
    If the given value is 0 then it should return 0.00
    

    Your return value always needs to have 2 decimal places, even if 1 or 2 of those decimal places are '0'. The error you mentioned indicates that you returned an answer of '2.4' instead of '2.40', you're missing a '0' on the end.