zoukankan      html  css  js  c++  java
  • 【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]
  • 相关阅读:
    Day10
    Day9
    Day8
    Day7
    Day 6
    Day5
    第一周计划
    事件总线模式辨析
    解释器模式辨析
    解释器模式深度探究
  • 原文地址:https://www.cnblogs.com/bcaixl/p/11658775.html
Copyright © 2011-2022 走看看