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.
This is clever, but not so intuitive in my opinion.
But I'm just getting started with Python and programming in general, so I might change my opinion further down the rabbit hole!
Hello,
from what I understand, if (number % a > 0 or number % b > 0) it will return False because then that is some value.
number % a here is equals to number % a > 0.
so, the program returns True if number % a and number % b DO NOT have any values( because then they are of value 0 )
thx! :) (Note: do not forget the spoiler flag, when you throw bits of code in the comments: they are visible from anyone in their dashboard)
This comment is hidden because it contains spoiler information about the solution
What list lengths were tested? If it's function calls that are expensive, it's still a constant factor, it may be able to significantly affect times for only really small lists.
@KenKamau: I understand. Don't get me wrong, this wasn't meant as criticism, just as a fun little observation in case other users wondered if and how the two top voted solutions differed.
@Unnammed: My comment was based on the following timeit results (first fct is sum(arr1+arr2):
So as you can see the performance difference is very small, but it's there. My best guess is that's caused by the additional function call which to my knowledge can be pretty expensive in Python.
Proof? I don't believe adding numbers can be slower than adding the same numbers and allocating memory for a whole list and copying everything.
It's 8 Kyu. I don't think about performance in such Katas.
This comment is hidden because it contains spoiler information about the solution