Ad
  • Default User Avatar

    This is because you are trying to do the calculation of 'd' within the loop- you have to do it after 'a' has been populated completely.
    Also, you have a typo when checking for v==8, a[i] == ...

  • Default User Avatar

    I had the same issue. I was calculating based on the largest. Good question and explnation.

  • Default User Avatar

    You can google "Python truncate to decimal places". I think the easy way to truncate is to take the int of "...". I am sure you will find what to put instead of "...".

  • Default User Avatar

    Asking for help is not an issue.
    PS: did you read all the description?

  • Custom User Avatar

    Not a kata issue, your code is inefficient, and that's explained in the error message:

    Execution Timed Out (12000 ms)

    Why did my code time out?
    Our servers are configured to only allow a certain amount of time for your code to execute. In rare cases the server may be taking on too much work and simply wasn't able to run your code efficiently enough. Most of the time though this issue is caused by inefficient algorithms. If you see this error multiple times you should try to optimize your code further.

    the follow code passes all the tests

    Well, actually it passes all tests before timing out, so there are more tests and your code doesn't pass them all.

    Read this: https://github.com/codewars/codewars.com/wiki/Troubleshooting-your-solution#timeout

  • Custom User Avatar

    No need to be sorry, if I would not like to "waste" my time, I would not reply.

    Don't worry, all of us were there.

  • Custom User Avatar

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