【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 ...
随机推荐
- SetDlgItemInt(函数详解)
参考:https://blog.csdn.net/for_cxc/article/details/51799194 SetDlgItemInt(hwnd, IDC_TEXT, FREQ_INIT, F ...
- 安装 Windows 10 系统时分区选择 MBR 还是 GUID?
一.MBR 和 GUID 的概述 MBR 分区表 MBR:Master Boot Record,即硬盘主引导记录分区表,指支持容量在2.1TB以下的硬盘,超过2.1TB的硬盘只能管理2.1TB,最多只 ...
- 多测师_git和github_004
git Git(读音为/gɪt/.),是目前世界上最先进的分布式版本控制系统,可以有效.高速的处理从很小到非常大的项目版本管理.Git 是 Linus Torvalds 为了帮助管理 Linux 内核 ...
- iot平台
iot平台 iot平台卓岚云是一个免费的物联网云平台,用户只需按步骤完成注册即可免费使用卓岚云 .支持PC.Android.iOS多平台终端.用户可以在任何地方远程访问任何地方的串口设备,并对远程设备 ...
- go-zero 如何应对海量定时/延迟任务?
一个系统中存在着大量的调度任务,同时调度任务存在时间的滞后性,而大量的调度任务如果每一个都使用自己的调度器来管理任务的生命周期的话,浪费cpu的资源而且很低效. 本文来介绍 go-zero 中 延迟操 ...
- 习题3-2 分子量(Molar Mass, ACM/ICPC Seoul 2007, UVa1586)
#include<stdio.h> #include<string.h> #include<ctype.h> double getweight(char x) { ...
- 【换根DP】小奇的仓库
题目背景 小奇采的矿实在太多了,它准备在喵星系建个矿石仓库.令它无语的是,喵星系的货运飞船引擎还停留在上元时代! 题目内容 喵星系有\(n\)个星球,星球以及星球间的航线形成一棵树. 从星球\(a\) ...
- go 不停模拟 写日志
package main import ( "os" "errors" "math/rand" "time" " ...
- package wang/test is not in GOROOT (/usr/local/go/src/wang/test)
如果要用 gopath模式 引入包 从src目录下开始引入 需要关闭 go mod 模式 export GO111MODULE=off 如果使用go mod 模式 export GO111MODULE ...
- centos8上使用gitosis管理git项目
零,centos8平台如何安装gitosis服务? 参见:centos8平台安装gitosis服务 地址:https://www.cnblogs.com/architectforest/p/12456 ...