In this simple exercise, you will build a program that takes a value, integer , and returns a list of its multiples up to another value, limit . If limit is a multiple of integer, it should be included as well. There will only ever be positive integers passed into the function, not consisting of 0. The limit will always be higher than the base.
For example, if the parameters passed are (2, 6), the function should return [2, 4, 6] as 2, 4, and 6 are the multiples of 2 up to 6.
If you can, try writing it in only one line of code.
def find_multiples(b, l):
a=[]
for i in range(b,l+1,b):
a.append(i)
return a
import codewars_test as test
from solution import find_multiples
@test.describe("Fixed Tests")
def fixed_tests():
@test.it('Basic Test Cases')
def basic_test_cases():
test.assert_equals(find_multiples(5, 25), [5, 10, 15, 20, 25])
test.assert_equals(find_multiples(1, 2), [1, 2])
test.assert_equals(find_multiples(6, 30), [6, 12, 18, 24, 30])