【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 ...
随机推荐
- 03 ArcPython实战篇一
1.自增计算 (字段计算器) total = 0 def accumulate(increment): global total if total: ...
- notepad快捷使用
1.快捷键 参考:https://www.php.cn/tool/notepad/428638.html notepad++是经常使用的一款编辑器软件,在编辑特殊文本的时候(html,java...) ...
- Java (四)APACHE Commons IO 复制文件
上一篇:Java (三)APACHE Commons IO 常规操作 例1:复制文件 1 import java.io.File; 2 import java.io.IOException; 3 4 ...
- Hadoop理论基础
Hadoop是 Apache 旗下的一个用 java 语言实现开源软件框架,是一个开发和运行处理大规模数据的软件平台.允许使用简单的编程模型在大量计算机集群上对大型数据集进行分布式处理. 特性:扩 ...
- Mac Idea你不知道的秘密
导读 工欲善其事必先利其器,日常工作中,知道这些Idea技巧,可以极大提高日常开发效率. 技巧篇 以下内容不分先后顺序 显示类中的方法 搜索 搜索方法,按两下shift 文字搜索,control+sh ...
- 多测师讲解requests __介绍_高级讲师肖sir
我们今天讲解的内容 一.什么是Requests? Requests是用Python语言编写的简单易用的HTTP库,用来做接口测试的库. 二.安装requests库 1.按住Windows标志+r,在运 ...
- nullptr解决了什么问题
从0到NULL 在C++的世界中字面值0用来表示空指针,所以0可以当作所有指针类型的字面值.为了让语义更明确引入了NULL宏定义: #undef NULL #ifdef __cplusplus #de ...
- CentOS8平台nginx日志的定时切分
一,编写bash脚本: [root@yjweb crontab]# vi split_nginx_logs.sh 代码: #!/bin/bash # 备份nginx的日志 # 昨天的日期 file_d ...
- CSDN的Markdown编辑器实用技巧(傻瓜式教程)
markdown编辑器被很多人声称是可以取代word的文字编辑器,其优点我们在这就不再过多赘述了,但对于一些初次接触的人来说,或多或少都有还些不适应,其主要原因在于一些常见的功能突然不知道怎么实现,所 ...
- 蓝桥杯 Island Hopping Java代码
问题描述 太平洋岛网公司(PLN)已经瞄向了太平洋中的一些群岛.这些群岛没有快捷的互联网连接.PLN计划向群岛提供互联网服务,以开发这个太平洋中潜在的市场.每组群岛的核心岛屿已经被深海电缆 ...