其他分享
首页 > 其他分享> > Codewars note:Can we divide it ?

Codewars note:Can we divide it ?

作者:互联网

My Codewars

 exercise:

Your task is to create the functionisDivideBy (or is_divide_by) to check if an integer number is divisible by both integers a and b.

A few cases:

(-12, 2, -6)  ->  true
(-12, 2, -5)  ->  false

(45, 1, 6)    ->  false
(45, 5, 15)   ->  true

(4, 1, 4)     ->  true
(15, -5, 3)   ->  true

Solution:
def is_divide_by(number, a, b):
    return number % a & number % b is 0

 

标签:12,false,divide,45,number,Codewars,note,true
来源: https://www.cnblogs.com/a001ai-es/p/16439589.html