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.
Hello! Try writing solutions for smaller arrays on paper (Note that there are many solutions). Some of them will help you find the pattern
I can't even solve this with pen and paper. Am I stupid or is this a very difficult one?
Any hints to get started?
Thank you :)
count
is very inefficient: each time you use it, it needs to parse the whole object it is applied to. There are much better alternatives in Python (make a smart research online and you should find it); there may be other points to enhance or change in your code, though.See there to format your code: https://docs.codewars.com/references/markdown/#code-block
Can someone explain why my code times out?
def find_uniq(arr):
a = [sorted(set(i.lower())) for i in arr]
for i in a:
if a.count(i) == 1:
return arr[a.index(i)]
Sorry, I don't know how to make indentation in a comment, but they are correct in my code.
Oh sh*t, yeah, I see what you mean now. Thanks.
Please print the input value with the test result, otherwise you'll never know what's wrong.
If a problem with the tests existed, somebody would have noticed before.
Your code is failing this sample test, you can see the expected answer is ok, your code is wrong:
There is no
n
in the input, your code is returning '@[`n'Yes, that is correct, but 'z' is 12 letters from 'n'. To get to the 13th letter from 'n', the program has to go back to 'a', or the ASCII value 097. But it seems like the test wants 'n' to be '{' which has the ASCII value 123.
All I can say is the ASCII value for 'z' is 122
I still don't get why my code's translation '@[´a' isn't correct.
The error message is like this: your wrong answer should equal the expected value. To see the input values, print them.
The random tests in python don't even substitute some of the characters. For example it says that something like 'QAnj\nf\nK(´75' should equal 'QA{j\nf\nK(´75'.
Only one of the characters is changed...
Another example is: '@[´n' should equal '@[´{'. But in a ROT13 transformation 'n' should equal 'a'.
The hint says: "For this task you're only supposed to substitue characters. Not spaces, punctuation, numbers etc."
my python returns true, if i do:
1/5 == 0.2
Because that's how floating point arithmetic work, not only in Python.
Helper question: how much is 1/5 in Python? Hint: its not 0.2.
Kata only works for perfect squares.
Loading more items...