本文整理汇总了Python中sum_of_multiples.sum_of_multiples函数的典型用法代码示例。如果您正苦于以下问题:Python sum_of_multiples函数的具体用法?Python sum_of_multiples怎么用?Python sum_of_multiples使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sum_of_multiples函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_multiples_of_5_6_or_8_up_to_150
def test_multiples_of_5_6_or_8_up_to_150(self):
self.assertEqual(sum_of_multiples(150, [5, 6, 8]), 4419)
示例2: test_configurable_4_6_to_15
def test_configurable_4_6_to_15(self):
self.assertEqual(30, sum_of_multiples(15, [4, 6]))
示例3: test_configurable_43_47_to_10000
def test_configurable_43_47_to_10000(self):
self.assertEqual(2203160, sum_of_multiples(10000, [43, 47]))
示例4: test_sum_to_1
def test_sum_to_1(self):
self.assertEqual(0, sum_of_multiples(1, [3, 5]))
示例5: test_sum_to_1000
def test_sum_to_1000(self):
self.assertEqual(233168, sum_of_multiples(1000, [3, 5]))
示例6: test_multiples_of_zero_will_be_none
def test_multiples_of_zero_will_be_none(self):
self.assertEqual(sum_of_multiples(1, [0]), 0)
示例7: test_multiples_of_several_factors
def test_multiples_of_several_factors(self):
self.assertEqual(sum_of_multiples(10000,
[2, 3, 5, 7, 11]), 39614537)
示例8: test_various_multiples_in_limit
def test_various_multiples_in_limit(self):
self.assertEqual(sum_of_multiples(7, [3]), 9)
示例9: test_various_factors_with_multiples_in_limit
def test_various_factors_with_multiples_in_limit(self):
self.assertEqual(sum_of_multiples(10, [3, 5]), 23)
示例10: test_multiples_with_no_factors_in_limit
def test_multiples_with_no_factors_in_limit(self):
self.assertEqual(sum_of_multiples(1, [3, 5]), 0)
示例11: test_multiples_of_one_factor_within_limit
def test_multiples_of_one_factor_within_limit(self):
self.assertEqual(sum_of_multiples(4, [3, 5]), 3)
示例12: test_multiples_of_1_up_to_100
def test_multiples_of_1_up_to_100(self):
self.assertEqual(sum_of_multiples(100, [1]), 4950)
示例13: test_multiples_of_43_or_47_up_to_10000
def test_multiples_of_43_or_47_up_to_10000(self):
self.assertEqual(sum_of_multiples(10000, [43, 47]), 2203160)
示例14: test_multiples_of_5_or_25_up_to_51
def test_multiples_of_5_or_25_up_to_51(self):
self.assertEqual(sum_of_multiples(51, [5, 25]), 275)
示例15: test_multiples_of_one_will_be_all
def test_multiples_of_one_will_be_all(self):
self.assertEqual(sum_of_multiples(100, [1]), 4950)