Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Now you got the logic right, but your code is timing out because you are computing
sum
of the long list twice in the for-loop. Instead, you can store the value before-hand or even better try to come up with an O(N) complexity-based algorithm.Your code is timing out because you are computing
sum
of the long list twice in the for-loop. Instead, you can store the value before-hand or even better try to come up with an O(N) complexity-based algorithm.sum(range(n+1))-(15+21)
Because of
for chunk in range(0, len(chunks)):
, eachchunk
is an integer.for digit in chunk:
is you trying to for-loop over that integer, which makes no sense. I think you wantfor chunk in chunks:
.range(n) = sequence from 0 to n-1
Hence, the sum is only upto 25
Your code has wrong indentation/closing braces.
sum(3) = 1 + 2, you're missing the last summand. 289 + 26 = 315.
Solutions and tests are concatenated in Python. If there's a syntax error in the first line of tests then it's probably due to an error in the last line of the solution.
Are you writing some code in the Sample Test panel? I've tested my code in both versions of Python and worked in both of them.
Try clicking reset and give it another try. You can also paste your current code here (check Mark as having spoiler content below)
It worked for me, copy and paste the error it gives you.
When you ask for help don't post an issue - you make the author lose points - post a question. As you could have seen at the top of the page 6319 guys passed the kata (1945 with Python) so there is no error in the tests. Google "UnicodeEncodeError: 'utf-8' codec can't encode character '\udcc3' surrogates not allowed".