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.
How does this account for string casing, i.e uppercase, lowercase?
maybe i'm wrong, but expressions a+bc and cb+a not make sense, how do you think?
In case of
in
it depends on data structure. Hashmap basedset
anddict
don't iterate items (unless everything has the same hash which is extremely unlikely), butlist
andtuple
do.Either author should specify that blatant
for
shouldn't be used or add tests accodringly to your' suggestion.Good to know thanks!
I think it would be more efficient to save it in a variable rather than calling it multiple times. It's not a big deal here because the lists are small (and maybe you have memory problems if the number is big? idk).
Basically ppl on CW just try to write all their code on one line regardless of efficency (as long as it passes all tests).
Hi, I see a lot of solutions on codewars that use len(x) (or min, lower, count...) in loops or throughout the code rather than doing it once and saving the result in a reusable variable, which I would think is more efficient. Is it not? Why do you use it this way? Readability? Code minimisation?
No, that's incorrect. This test is expected to return
False
.yes, tests are wrong.
[3,2,4,2,3,3,3,3,3,3,3,3,3,2,3,3] is expected to return True, which is wrong
This test couldn't check for
True
because the reference solution returnsFalse
for this case.The random tests for python are not correct, for example:
[2, 3, 3, 3, 3, 3, 1, 3, 3, 3, 2] should be False, but it checks for True
(You can make one row with 2+2 and one row with 1+3, than you have only threes left)