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.
You just chose to post under a solution that has no c at all, but seeing other solutions, it's a short form of character or char.
I'm new to python and I am curious to why yall use c? What is c?
for some reason I didn't think of using the int() funtion within the if statement. I feel like an idiot lmao
Mine was pretty much the same I just used s instead of result
Could be people copying answers they want to dissect and understand better and then clicking "Submit" to run against the attempt test cases instead of forking them.
I think when they were unable to make it, unlocked solutions and copied to see how it works
nice job
its split not splite in JS
I also solved it.
For example. When I was at the university, together with the teacher, we solved with the whole group.I don’t support copying solutions, then you don’t remember anything.
I find it fascinating how there's always so many people who have the exact same answer as the top solution, character-for-character, and the long tail of similar equivalent solutions if you scroll down that don't have as many votes all have exactly one match. Can't possibly be because people are copying answers on this site, why would people do that and cheat themselves of a learning experience?
I decided so too :)
That's an implementation detail I was relying on. Since that string's reference counter is 1, the add-assign operator could try to add to the existing string (while the add operator cannot do that, as the assignment comes later).
Well, it used to be more efficient.
I just did a
timeit.timeit
on Python 3.8.5 (on very long strings, a billion characters), and the add first then assign version was same for short strings, about twice as fast for longer strings. Which is the opposite of what I expected.Maybe I did my previous tests on Python 2.7, quite possible. Interesting, I never thought that part would change. Or my tests back then were wrong (I was still relatively new to Python).
(My own solution does use a generator expression instead of a list, but pretty much agree on the overall design)
result += "0" still creates a new string.
Strings in Python are immutable. You can't change them.
If you change the, you will always create a new string - doesn't matter what operator you use.
Use lists if you want to avoid recreating strings for each iteration.
See my solution if needed.
exactly like mine :)
Loading more items...