【Kata Daily 191012】Find numbers which are divisible by given number
题目:
Complete the function which takes two arguments and returns all numbers which are divisible by the given divisor. First argument is an array of numbers
and the second is the divisor
.
Example
divisible_by([1, 2, 3, 4, 5, 6], 2) == [2, 4, 6]
解题方法:
def divisible_by(numbers, divisor): return [x for x in numbers if x%divisor == 0]