Ad
  • Default User Avatar

    Yes you're right. I just get this error when I print the larger int values. I guess the ints get converted to strings first, and there's a limit on string lengths.

    "ValueError: Exceeds the limit (4300) for integer string conversion; use sys.set_int_max_str_digits() to increase the limit"

  • Default User Avatar

    See above, this occurs when you print the integer value.

  • Default User Avatar

    In particular I don't think you can solve the problem without a call to this: sys.set_int_max_str_digits()

  • Default User Avatar

    Did you ban sys? It's needed for large ints in Python.

  • Default User Avatar

    Oh sorry man, I got busy with work. Was going to do it today. Thanks for helping me with it - and then doing it.

  • Default User Avatar

    Ok I've done that.

    I ended up just putting in the larger powers of 10 in the format 100_000_000_000_000. I hope that's OK?

    I ran it gain, all fine. Then I published again and got an error about failed tests?

  • Default User Avatar

    I don't think I use numbers larger than 2**53.

    The Python tests I copied used 10**14.

    But the tests should probably be more numerous and for bigger numbers. I have no idea how to decide how many or how large to make them. Should I do this via trial and error?

    I could change everything to int64s or even math/Big I guess, but is this is what's wanted?

  • Default User Avatar

    Bugger, I think I forgot to put package kata as the first line in the solution setup.

  • Default User Avatar

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

  • Default User Avatar

    Thanks. But the author still has to be active to accept the translation I think.

    I haven't done the translation yet, but will do so.

  • Default User Avatar

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

  • Default User Avatar

    I've been using Go for a while. It would be cool to translate this into Go. But I've always found translations difficult to do. Usually the myself and the kata author have no idea how to do it.

    If I translated it into Go, would you help me do that?

  • Default User Avatar

    Thanks for ressurecting this kata, it's a pretty good one.

    I don't understand the way you're handling the new lines at all. I don't see why my original code works for all but a few tests? There must be something different about those ones.

    But I'll just use that last line of code you provided. Thanks again.

  • Default User Avatar

    To get it to pass, I had to do this:

    if width == 3 and height == 3:
        return outputString[1:-1]
    if width == 5 and height == 5:
        return outputString[1:-1]
    if width == 10 and height == 10:
        return outputString[1:-1]
    return outputString
    

    So that it removes the leading and trailing '\n' for the small tests.

  • Default User Avatar

    The last few lines of my code - which I use to return the problem in the correct format are these:

    outputString = "\n"
    for row in theMap:
        outputString += ''.join(row) + '\n'
    return outputString
    

    Which gives the correct format for the bulk of the problems. If I remove the leading and trailing '\n' then the first few tests pass, but the rest don't.

  • Loading more items...