【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]
【Kata Daily 191012】Find numbers which are divisible by given number的更多相关文章
- 【Kata Daily 190929】Password Hashes(密码哈希)
题目: When you sign up for an account somewhere, some websites do not actually store your password in ...
- 【Kata Daily 190923】Odder Than the Rest(找出奇数)
题目: Create a method that takes an array/list as an input, and outputs the index at which the sole od ...
- 【Kata Daily 190920】Square(n) Sum(平方加总)
题目: Complete the square sum function so that it squares each number passed into it and then sums the ...
- 【Kata Daily 190919】Sort Out The Men From Boys(排序)
题目: Scenario Now that the competition gets tough it will Sort out the men from the boys . Men are th ...
- 【Kata Daily 190911】Multiplication Tables(乘法表)
题目: Create a function that accepts dimensions, of Rows x Columns, as parameters in order to create a ...
- 【kata Daily 190905】What's a Perfect Power anyway?(完美幂)
原题: A perfect power is a classification of positive integers: In mathematics, a perfect power is a p ...
- 【Kata Daily 190904】Calculating with Functions(函数计算)
原题: This time we want to write calculations using functions and get the results. Let's have a look a ...
- 【Kata Daily 191010】Grasshopper - Summation(加总)
题目: Summation Write a program that finds the summation of every number from 1 to num. The number wil ...
- 【Kata Daily 190927】Counting sheep...(数绵羊)
题目: Consider an array of sheep where some sheep may be missing from their place. We need a function ...
随机推荐
- C++ 中explicit的作用
转载:https://www.cnblogs.com/diligenceday/p/5781408.html C++ 中explicit的作用 explicit作用: 在C++中,explicit ...
- matlab中sum
来源:https://ww2.mathworks.cn/help/matlab/ref/sum.html?searchHighlight=sum&s_tid=doc_srchtitle#btv ...
- matlab做gaussian高斯滤波
原文链接:https://blog.csdn.net/humanking7/article/details/46826105 核心提示 在Matlab中高斯滤波非常方便,主要涉及到下面两个函数: 函数 ...
- 如何检测ASP中的浏览器。NET与浏览器文件
介绍 ASP.NET是一个用于使用Web表单.MVC.Web API和SignalR(这是官方定义)构建Web应用程序的高生产力框架.它是在.net框架上开发RESTful应用程序或使用HTML.CS ...
- 用python处理excel文件有多轻松?工作从未如此简单
最近需要频繁读写 excel 文件,想通过程序对 excel 文件进行自动化处理,发现使用 python 的 openpyxl 库进行 excel 文件读写实在太方便了,结构清晰,操作简单.本文对 o ...
- CentOS7 下 swap 分区的创建、删除及相关配置
一般我们在购买云服务器(例如:阿里云ECS.腾讯云服务器)的时候,选择 CentOS 7 系统之后,登录系统,发现 swap 大小为 0(即没有分配). 如果我们想在该 服务器上安装 Oracle 数 ...
- bootStrap小结2
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Conten ...
- 【最短路】CF 938D Buy a Ticket
题目大意 流行乐队"Flayer"将在\(n\)个城市开演唱会,这\(n\)个城市的人都想去听演唱会,每个城市的票价不同,于是这些人就想是否能去其他城市听演唱会更便宜,但是去其他的 ...
- linux设置系统变量
[root@localhost test]# export AUTHOR=brady [root@localhost test]# echo $AUTHOR brady [root@localhost ...
- 详解Kubernetes微服务自动化发布系统
实施微服务架构后,原先单一的系统结构统变成了数量众多的微服务应用,开发.测试.运维部署等都会面临不少挑战.在微服务架构下如何提高工程研发效率,确保开发.测试.运维部署等流程上的顺畅,是微服务技术体系能 ...