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.
beacuse "sum" is reserved name for sum function. and we cant use reserved names if follow PEP8 rules.
why is sum not okay?
O(n) is good, but you can do better
see my solution :)
Maybe that's a C echoing in the authors head :)
I thought the same, but than I tested and noticed that if you input a negative number to the range function, it gives you always a 0. So the code also considers negative numbers
牛逼,学习
negative numbers are not considered in this code
approve
I don't think the parenthesis around the modulos are serving any purpose here. They can be removed
too long, and do not use "sum" for name of variable
Could've compile regex first
nice!!!
since it is used as a variable I think it doesn't pose any problems here. But I still agree that this is not a good practice
after a kata forcing me to learn regex I now start to appreciate it a lot!
"find pattern and do sth with it" vibe that regex methods give seems more readable than other methods (where lil setups scattered around & can be confusing at the beginning uh for a newbie like me)
I agree w/ @sine that a variable named 'sum' isn't wise. That withstanding, my solution was the same. This solution consistently runs about a half second faster than the higher voted one-liner with input of 100,000,000, and I'd argue it is easier to read.
Loading more items...